Constants like e and eulergamma in Julia V1.0 no longer available?

Hello,
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!

Regards,
Guenter

1 Like

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:

julia> e
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.

5 Likes

Searching for euler does not give any result in the documentation.

Ha, yes it’s because the word “Euler” doesn’t appear on its own… :slight_smile: You can search for

euler'

which finds it in Euler's constant.

(or eulergamma…)

But there’s plenty of room for improvement…

1 Like
julia> apropos("euler")
Base.MathConstants.eulergamma
Base.MathConstants.γ
SpecialFunctions.cosint

gives at least some hint ^^

7 Likes

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:

julia> e
e = 2.7182818284590...

But julia> MathConstants.e works! Thank you for this hint!
Cheers,
Guenter

1 Like

If an answer has solved your problem, please mark it as ‘solved’ so people know that your question has been answered :slight_smile:

@Gunter_Faes: can you please link the the doc-example in question?

Hi mauro3

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! :grinning:

Regrads,
Guenter

1 Like

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.

1 Like

Hi Mauro,

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! :thinking:

Cheers,

Guenter

Don’t panic! It’s all still there and the defaults are pretty reasonable. :slightly_smiling_face:.

In Base, π is still there. e is no longer the Euler number, but (\euler) is and it’s still exported by Base.

For other stuff you can do e.g.

using .MathConstants: γ
1 Like

e was considered too common a variable name to assign by default, particularly in situations like this:

julia> try
        error()
        catch
        @show e
        end
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.

3 Likes