#18210: numerical bug in incomplete gamma function
-------------------------------+------------------------
       Reporter:  VivianePons  |        Owner:
           Type:  defect       |       Status:  new
       Priority:  major        |    Milestone:  sage-6.7
      Component:  symbolics    |   Resolution:
       Keywords:  sd67         |    Merged in:
        Authors:               |    Reviewers:
Report Upstream:  N/A          |  Work issues:
         Branch:               |       Commit:
   Dependencies:               |     Stopgaps:
-------------------------------+------------------------
Description changed by rws:

Old description:

> The following code:
>

> {{{
> sage: var('R k')
> (R, k)
> sage: integrated = -(gamma(1/2*k, 1/2*R*k) - gamma(1/2*k))/gamma(1/2*k)
> sage: plot(integrated.subs(k=41), (R,0,6))
> }}}
>
> gives a Seg fault error and crashes Sage entirely:
>
>  line 134:  4216 Segmentation fault      (core dumped)
>
> I believe it comes from the symbolic computation because the following
> code is working:
>

> {{{
> sage: var('R k')
> (R, k)
> sage: integrated = -(gamma(1/2*k, 1/2*R*k) - gamma(1/2*k))/gamma(1/2*k)
> sage: plot(integrated.subs(k=41.), (R,0,6))
> }}}
>
> (Note the 41. instead of 41)
>
> I have no idea where this comes from but it's really bad, because
> whatever is going wrong, crashing Sage is bad!

New description:

 Wrong values from incomplete gamma:
 {{{
 $ ./sage -v
 SageMath Version 6.7.beta1, Release Date: 2015-04-15

 $ ./sage
 sage: gamma(60, 30).numerical_approx()
 -1.28306738270893e74
 }}}
 Reason is a bug in Pari:
 {{{
 ? \p 50
    realprecision = 57 significant digits (50 digits displayed)
 ? incgam(60,30)
 %2 = 1.3868299023788799504133735635863795825413935892945 E80
 ? \p 30
    realprecision = 38 significant digits (30 digits displayed)
 ? incgam(60,30)
 %3 = -1.23084064495468737276106696496 E74
 }}}

 Previous description:

 The following code:


 {{{
 sage: var('R k')
 (R, k)
 sage: integrated = -(gamma(1/2*k, 1/2*R*k) - gamma(1/2*k))/gamma(1/2*k)
 sage: plot(integrated.subs(k=41), (R,0,6))
 }}}

 gives a Seg fault error and crashes Sage entirely:

  line 134:  4216 Segmentation fault      (core dumped)

 I believe it comes from the symbolic computation because the following
 code is working:


 {{{
 sage: var('R k')
 (R, k)
 sage: integrated = -(gamma(1/2*k, 1/2*R*k) - gamma(1/2*k))/gamma(1/2*k)
 sage: plot(integrated.subs(k=41.), (R,0,6))
 }}}

 (Note the 41. instead of 41)

 I have no idea where this comes from but it's really bad, because whatever
 is going wrong, crashing Sage is bad!

--

--
Ticket URL: <http://trac.sagemath.org/ticket/18210#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to