Conversation

Charlotte 🦝 therian

does someone know of a decent partial gamma function approximation G(a, x) where a > 0 and 0 < x < 1?

2
1
1

@charlotte sounds like the job for a taylor expansion

1
0
0

@charlotte oh wait, of *two* variables? I'm not familiar with a gamma function of two variables. Dunno how that would work with taylor series

1
0
0
@vikxin
yeah i have the regular gamma function as a library function but this algorithm calls for a generalization for that (G(a) is equivalent to G(a, 0) aiui)
1
0
0

@charlotte Do you know how the generalized gamma function is defined? Also why an approximation? Can it not be implemented efficiently without an approximation?

1
0
0
@vikxin
the gamma function integrates from 0 to infinity, the "upper partial" gamma function (the one i want) integrates from x to infinity

(the lower from 0 to x, but that is of course just G(a)-G(a,x))
1
0
0

@charlotte Gotcha. This seems solvable, but will probably require more calculus than I remember how to do at this point.

1
0
0

@vikxin also i don’t need high precision, that’s why approximation

i can probably just port a c implementation of this to rust but maybe you knew something about it

1
0
0

@charlotte not offhand, no

0
0
0

i ended up just porting math.net’s implementation of these functions https://github.com/mathnet/mathnet-numerics/blob/master/src/Numerics/SpecialFunctions/Gamma.cs

0
0
1