No gamma function found in Version 1.0.1 (2018-09-29)

I have just installed Julia Version 1.0.1 (2018-09-29) and the gamma function does not seem to exist. With

julia> gamma(6)

I get

ERROR: UndefVarError:  gamma not defined
Stacktrace:
 [1] top-level scope at none:0

But factorial(6), log(6), etc. work just fine.

How do I get access to the gamma function? (The documentation states that it is part of base.)

2 Likes

Using 0.7

julia> gamma(0.5)
ERROR: gamma has been moved to the package SpecialFunctions.jl.
Run `Pkg.add("SpecialFunctions")` to install it, restart Julia,
and then run `using SpecialFunctions` to load it.

That should be fixed, could you show where?

7 Likes

Obviously I’m new to Julia. And I certainly misread the documentation as I cannot find where the documentation states that gamma is part of base.

And maybe my problems are deeper than even that. When I type in

julia> Pkg.add("SpecialFunctions")

on version 1.0.1.1 I get

ERROR: UndefvarError: Pkg not defined
2 Likes

From one of your other answers I see how to fix things.

I need to use

using Pkg

first. Then the Pkg.add commend.

Thanks!

3 Likes

In 1.0, in the REPL type

]add SpecialFunctions

The character ] brings you into the package manager (Pkg) REPL mode.

1 Like

Thanks but my other issue that I posted earlier is that Julia won’t start in REPL mode and only in Legacy mode when using Atom. However, once I get that issue fixed I’ll certainly use what you listed. Thanks!