#15354: elliptic_j function should not compute numerically unless asked for
----------------------------+------------------------------------
Reporter: davidamadore | Owner:
Type: defect | Status: new
Priority: minor | Milestone: sage-5.13
Component: symbolics | Keywords: special function
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
----------------------------+------------------------------------
Sage's elliptic_j function does not behave similarly to the other standard
or special functions: it tries to numerically evaluate instead of building
a symbolic expression:
{{{
sage: elliptic_j(I)
1728.00000000000
sage: elliptic_j(x)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-5-b3ba173d2e63> in <module>()
----> 1 elliptic_j(x)
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/functions/special.pyc in elliptic_j(z)
803 CC = ComplexField()
804 try:
--> 805 z = CC(z)
806 except ValueError:
807 raise ValueError, "elliptic_j only defined for complex
arguments."
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/rings/complex_field.pyc in __call__(self, x, im)
345 if im is not None:
346 x = x, im
--> 347 return Parent.__call__(self, x)
348
349 def _element_constructor_(self, x):
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
(sage/structure/parent.c:8372)()
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3856)()
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3757)()
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/rings/complex_field.pyc in _element_constructor_(self, x)
375 pass
376 try:
--> 377 return x._complex_mpfr_field_( self )
378 except AttributeError:
379 pass
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/symbolic/expression.so in
sage.symbolic.expression.Expression._complex_mpfr_field_
(sage/symbolic/expression.cpp:7534)()
/usr/src/local/sage-5.12/local/lib/python2.7/site-
packages/sage/symbolic/expression.so in
sage.symbolic.expression.Expression._eval_self
(sage/symbolic/expression.cpp:6913)()
TypeError: Cannot evaluate symbolic expression to a numeric value.
}}}
This is very weird: it means, for example, that
plot(real(elliptic_j(x+I)), (x,0,1)) will fail (instead, one must use
plot(lambda t: real(elliptic_j(t+I)), (0,1)))
--
Ticket URL: <http://trac.sagemath.org/ticket/15354>
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/groups/opt_out.