JuliaMath / SpecialFunctions.jl

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

What about `gamma_inc_inv`'s derivative ? #452

Open lrnv opened 11 months ago

lrnv commented 11 months ago

I am hitting the following issue :

ERROR: MethodError: no method matching __gamma_inc_inv(::ForwardDiff.Dual{...}, ::ForwardDiff.Dual{...}, ::Bool)

Is there somewhere an implementation for such a derivative ? I guess the routines for the inverse of the gamma incomplete function are based on numerical root finding, so it that even possible ?

stevengj commented 11 months ago

There are analytical formulas for the derivatives. One of them is fine, but the other involves the Meijer G function, which we don't have (#265).

We could add a chain rule for the derivative with respect to the second argument, but ForwardDiff doesn't support ChainRules (unless you also import https://github.com/ThummeTo/ForwardDiffChainRules.jl, which we don't currently do here).

lrnv commented 11 months ago

It looks like the derivatives you linked to on wikipedia are for the gamma incomplete function, and not its inverse, if I am not mistaking.