I am currently working my way through the Julia documentation and the examples and stumble over the Euler number e. In Julia V0.6 I could still call them, but in Julia V1.0.1 I get the message “ERROR: UndefVarError: e not defined”. Does this constant no longer belong to the Julia base, is the documentation no longer correct?
Thanks for any hint!
If you use version 0.7, you can get helpful deprecations messages for these kinds of problems. Here’s what happens in version 0.7:
WARNING: Base.e is deprecated, use ℯ (\euler) or `Base.MathConstants.e`
in module Main
ℯ = 2.7182818284590...
Every time you stumble across functionality that is missing from previous version of Julia, just open v0.7.
euler does not give any result in the documentation.
Ha, yes it’s because the word “Euler” doesn’t appear on its own… You can search for
which finds it in
But there’s plenty of room for improvement…
gives at least some hint ^^
Yes, that’s right. But the attempt to rework the documentation is not successful (possibly a language problem for me) because the example no longer works under V1.0:
e = 2.7182818284590...
But julia> MathConstants.e works! Thank you for this hint!
If an answer has solved your problem, please mark it as ‘solved’ so people know that your question has been answered
@Gunter_Faes: can you please link the the doc-example in question?
here the Link. This is pi but the next example is e. But I am very happy to see that someone is working on the documentary. The example for the constant catalan has been adapted!
But in that example, you get the italics e, which does work just like that:
julia> ℯ # type \euler+tab to get it
ℯ = 2.7182818284590...
also copy paste from the docs works for me. Admittedly it’s a bit hard to spot the difference between e and e.
Yeah, that sounds pretty weird! In version 0.6 the “quite normal” e works. I don’t think the implementation under V1.0 is well solved from the IT point of view!
Don’t panic! It’s all still there and the defaults are pretty reasonable. .
π is still there.
e is no longer the Euler number, but
\euler) is and it’s still exported by
For other stuff you can do e.g.
using .MathConstants: γ
e was considered too common a variable name to assign by default, particularly in situations like this:
e = ℯ = 2.7182818284590...
(people often use
e for the exception object so if they forgot it on the catch they kept logging/showing Euler’s constant). The unicode version (\euler) was not considered too short, so that export was kept. If you want the ASCII export, you can put
using Base.MathConstants at the top of your function.