On 2014-05-03, suvrat.r...@gmail.com <suvrat.r...@gmail.com> wrote: > I am new to Sage; trying to explore open source alternatives to > Mathematica. > > However, I seem to be having trouble with the incomplete gamma function. > Here are two difficulties. First, in trying to evaluate the incomplete > gamma function at a point where the result should be very small, I just get > zero even if I increase the precision arbitrarily. In particular consider > > numerical_approx(gamma(9, 10^(-3))-gamma(9), digits=40) > > the value of this number is approximate -1.1 \times 10^(-28), but I just > get 0.00000 ...0 for the input above.
I think this is a bug in the Sage's interface to PARI's incomplete gamma-function implementation. The latter has a parameter 'precision' that actually allows you do increase the precision of the computation here as much as you like. E.g. sage: pari(9).incgam(1/1000,precision=100).sage() - gamma(9) -1.1101098718046915201731717980618372763e-28 (the part pari(9).incgam(1/1000,precision=100) calls the PARI's incomplete gamma-function code, and .sage() pulls it back into Sage.) and you can increase the precision, e.g.: sage: pari(9).incgam(1/1000,precision=200).sage()-gamma(9) -1.110111565517708813007363808370583494179636586117301130595952112736737061589e-28 sage: pari(9).incgam(1/1000,precision=500).sage()-gamma(9) -1.11011156551770881300736380837058349417963658951616739908084575093982182228943211704794146886994896523236690487484369923202470676572472807219205439592102e-28 etc. Any takes to fix this? (meanwhile, you can use the workaround as above) HTH, Dmitrii -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.