JuliaMath / SpecialFunctions.jl

Special mathematical functions in Julia
https://specialfunctions.juliamath.org/stable/
Other
352 stars 99 forks source link

Functions defined on both Base and SpecialFunctions.jl? #61

Closed BoundaryValueProblems closed 6 years ago

BoundaryValueProblems commented 6 years ago

Hello. My understanding is that some of the special functions previously defined in Base have been moved to SpecialFunctions.jl. However, when I look at erf for example, all of the three executions:

erf(1.0)
Base.erf(1.0)
SpecialFunctions.erf(1.0)

work (I'm using julia v0.6.1). Is erf defined both on Base and Specialfunctions.jl now, but will soon be only available in SpecialFunctions.jl? And which one is called if I simply execute erf(1.0)? Or all of the above three lines call the same function so that I don't have to worry about? I would greatly appreciate it if you could explain what is the current status on some of the special functions. Happy Thanksgiving! BVPs

PS: Of course, I know the following note (from the SpecialFunctions.jl document):

Prior to Julia 0.6, most of these functions were available in Julia's Base module. 
Because of this, the symbols from this package are not exported on Julia 0.5 to avoid name conflicts. 
In this case, the symbols will need to be explicitly imported or called with the prefix SpecialFunctions. 
This is not necessary for Julia versions 0.6 and later.
ararslan commented 6 years ago

Note that erf(1.0) will not work in Julia 0.6 and later without using SpecialFunctions. The reason why Base.erf works after loading SpecialFunctions is that the package overwrites the deprecation. That is, it extends Base.erf to provide the methods that used to be defined in Base. When the deprecation is removed from Base, calling Base.erf will no longer work, and instead the symbol is defined in the package rather than extending the symbol in Base. That's all implementation details though; as long as you've done using SpecialFunctions, you can call erf directly no matter what version of Julia you're using.

BoundaryValueProblems commented 6 years ago

Thanks a lot for your explanation, @ararslan !! I'll close this issue then.