#10072: Bug in log gamma evaluation
--------------------------------+-------------------------------------------
Reporter: kcrisman | Owner: AlexGhitza
Type: defect | Status: new
Priority: major | Milestone: sage-4.6.1
Component: basic arithmetic | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Old description:
> However `log_gamma` is numerically evaluated, it seems to be wrong (or on
> another branch?)
> {{{
> sage: log_gamma(i).n()
> -0.0219785471672303 - 0.168184318273662*I
> sage: log_gamma(pari(i))
> -0.650923199301856 - 1.87243664726243*I
> }}}
> And in Sage's Maxima:
> {{{
> (%i3) ev(log_gamma(%i),numer);
> (%o3) - 1.872436647262428 %i - .6509231993018556
> }}}
> The relevant bit of code is
> {{{
> sage: a = log_gamma(i)
> sage: a._convert(RealField(53).complex_field())
> -0.0219785471672303 - 0.168184318273662*I
> }}}
> But I'm not sure if this problem is in Pynac or in !RealField.
New description:
When `log_gamma` is naively numerically evaluated, it seems to be wrong.
{{{
sage: log_gamma(i).n()
-0.0219785471672303 - 0.168184318273662*I
}}}
Pari gives this:
{{{
sage: log_gamma(pari(i))
-0.650923199301856 - 1.87243664726243*I
}}}
And in Sage's Maxima:
{{{
(%i3) ev(log_gamma(%i),numer);
(%o3) - 1.872436647262428 %i - .6509231993018556
}}}
And in ginsh for Ginac 1.5.8:
{{{
> lgamma(I);
-0.65092319930185634056+4.41074865991715666*I
}}}
which is pretty clearly a different branch choice from Maxima and Pari
(the complex part is exactly `2*pi` away from Maxima and Pari).
The relevant bit of code is
{{{
sage: a = log_gamma(i)
sage: a._convert(RealField(53).complex_field())
-0.0219785471672303 - 0.168184318273662*I
}}}
But I'm not sure if this problem is in Pynac or in the Sage complex field.
--
Comment(by kcrisman):
More mysterious (after MUCH trouble trying to get Ginac to compile on OS X
- needed to install CLN, pkg-config, and readline!!!):
{{{
ginsh - GiNaC Interactive Shell (ginac V1.5.8)
__, _______ Copyright (C) 1999-2010 Johannes Gutenberg University
Mainz,
(__) * | Germany. This is free software with ABSOLUTELY NO
WARRANTY.
._) i N a C | You are welcome to redistribute it under certain
conditions.
<-------------' For details type `warranty;'.
Type ?? for a list of help topics.
> lgamma(I);
-0.65092319930185634056+4.41074865991715666*I
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10072#comment:6>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.