how to do gamma function and quadgk function in ADCME

Viewed 158

I am very new to Julia, and I know I can use the SpecialFunctions package to use the gamma function, but if for example, I write:

using SpecialFunction
using ADCME
s = Variable(1.0); c = gamma(s)

then I will run into the error gamma not defined, so how can I write gamma function in PyObject My second question is that I can write

using QuadGK
int = quadgk(f, a, b)

but there is no quadgk function in ADCME, so what should I do? Should I make an estimation by trapezoid rule or something like that?

1 Answers

If you are using Julia 0.7+, you need to do the following:

(@v1.5) pkg> add SpecialFunctions

julia> using SpecialFunctions

julia> gamma(0.5)
1.772453850905516

and the gamma function will be defined.

Related