#10849: behaviour of gamma strangely sensitive
-------------------------+--------------------------------------------------
Reporter: dsm | Owner: burcin
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.0
Component: symbolics | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: Burcin Erocal
Merged: | Dependencies: #7160
-------------------------+--------------------------------------------------
Changes (by newvalueoldvalue):
* status: new => needs_review
* milestone: sage-4.8 => sage-5.0
* dependencies: => #7160
* author: => Burcin Erocal
Old description:
> Whether you get the correct result or a spurious ValueError in evaluating
> some gamma expressions depends upon things it shouldn't.
>
> This comes from [http://groups.google.com/group/sage-
> support/browse_thread/thread/3b7126c1a29db091# a sage-support thread]; I
> looked and couldn't find it here, but possibly it's a duplicate. (I have
> bad luck with trac.)
> See also [http://demo.sagenb.org/home/pub/66/ this worksheet].
>
> Here's a relatively simple test case, in 4.6.1 and 4.6.2.rc0:
>
> {{{
> sage: x = var("x")
> sage: f = exp(gamma(I*x-1/2).subs(x=I*x))
> sage: g=f.operands()[0]
> sage: g, type(g)
> (gamma(-x - 1/2), <type 'sage.symbolic.expression.Expression'>)
> sage: g(x=0)
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call
> last)
>
> /Applications/sage_devel/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-
> packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression.__call__
> (sage/symbolic/expression.cpp:15657)()
>
> /Applications/sage/local/lib/python2.6/site-
> packages/sage/symbolic/ring.so in
> sage.symbolic.ring.SymbolicRing._call_element_
> (sage/symbolic/ring.cpp:6537)()
>
> /Applications/sage/local/lib/python2.6/site-
> packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression.substitute
> (sage/symbolic/expression.cpp:15036)()
>
> /Applications/sage/local/lib/python2.6/site-
> packages/sage/symbolic/pynac.so in sage.symbolic.pynac.py_doublefactorial
> (sage/symbolic/pynac.cpp:9463)()
>
> ValueError: argument must be >= -1
> sage: g(x=0)
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call
> last)
> [ ... duplicate removed; this is merely to show it's not only the first
> call which has problems ]
> ValueError: argument must be >= -1
> sage: gamma(-x-1/2)*g
> gamma(-x - 1/2)^2
> sage: g(x=0)
> -2*sqrt(pi)
> }}}
>
> That is, merely performing the should-be-irrelevant "gamma(-x-1/2)*g" op
> makes g(x=0) start working. Instrumenting it shows that that
> py_doublefactorial gets a -3 the first time instead of the 1 it does the
> second time, but I couldn't quite follow the calling order to isolate the
> error.
New description:
Whether you get the correct result or a spurious ValueError in evaluating
some gamma expressions depends upon things it shouldn't.
This comes from [http://groups.google.com/group/sage-
support/browse_thread/thread/3b7126c1a29db091# a sage-support thread]; I
looked and couldn't find it here, but possibly it's a duplicate. (I have
bad luck with trac.)
See also [http://demo.sagenb.org/home/pub/66/ this worksheet].
Here's a relatively simple test case, in 4.6.1 and 4.6.2.rc0:
{{{
sage: x = var("x")
sage: f = exp(gamma(I*x-1/2).subs(x=I*x))
sage: g=f.operands()[0]
sage: g, type(g)
(gamma(-x - 1/2), <type 'sage.symbolic.expression.Expression'>)
sage: g(x=0)
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
/Applications/sage_devel/<ipython console> in <module>()
/Applications/sage/local/lib/python2.6/site-
packages/sage/symbolic/expression.so in
sage.symbolic.expression.Expression.__call__
(sage/symbolic/expression.cpp:15657)()
/Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/ring.so
in sage.symbolic.ring.SymbolicRing._call_element_
(sage/symbolic/ring.cpp:6537)()
/Applications/sage/local/lib/python2.6/site-
packages/sage/symbolic/expression.so in
sage.symbolic.expression.Expression.substitute
(sage/symbolic/expression.cpp:15036)()
/Applications/sage/local/lib/python2.6/site-
packages/sage/symbolic/pynac.so in sage.symbolic.pynac.py_doublefactorial
(sage/symbolic/pynac.cpp:9463)()
ValueError: argument must be >= -1
sage: g(x=0)
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
[ ... duplicate removed; this is merely to show it's not only the first
call which has problems ]
ValueError: argument must be >= -1
sage: gamma(-x-1/2)*g
gamma(-x - 1/2)^2
sage: g(x=0)
-2*sqrt(pi)
}}}
That is, merely performing the should-be-irrelevant "gamma(-x-1/2)*g" op
makes g(x=0) start working. Instrumenting it shows that that
py_doublefactorial gets a -3 the first time instead of the 1 it does the
second time, but I couldn't quite follow the calling order to isolate the
error.
Apply attachment:trac_10849-doctests.patch
--
Comment:
This is fixed with the patch attached to #7160. Doctests are in
attachment:trac_10849-doctests.patch.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10849#comment:5>
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.