Dear Mani chandra,
something really weird seems to be going on. This is a fresh session
of Sage 3.3:
sage: complex(0,1)*spherical_bessel_J(1,1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/king/.sage/temp/mpc739/24191/_home_king__sage_init_sage_0.py in
<module>()
/home/king/SAGE/devel/sage-3.2.3/local/lib/python2.5/site-packages/
sage/structure/element.so in
sage.structure.element.RingElement.__mul__ (sage/structure/element.c:
8632)()
/home/king/SAGE/devel/sage-3.2.3/local/lib/python2.5/site-packages/
sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/
coerce.c:5847)()
TypeError: unsupported operand parent(s) for '*': '<type 'complex'>'
and 'Symbolic Ring'
sage: complex(0,1)*spherical_bessel_J(1,1)
1.0*(sin(1) - cos(1))*I
In other words, calling complex(0,1)*spherical_bessel_J(1,1) for the
first time yields a bug. Calling it the second time yields a result.
Do people agree that this is a bug? Shall I open a ticket?
I guess that, as a work-around, you should consider using a different
implementation of the complex unit in Sage.
There are (at least):
* complex(0,1), which AFAIK is a Python builtin
* I, which belongs to the "Symbolic Ring":
sage: I^2
-1
sage: I.parent()
Symbolic Ring
* The imaginary unit in the complex double field:
sage: CDF(0,1)
1.0*I
sage: CDF(0,1)^2
-1.0 + 1.22464679915e-16*I
As you can see, CDF is numeric with the usual errors of numerical data
types.
Since "spherical_bessel_J" lives in the Symbolic world, i guess that
using "I" would work around the error.
Cheers,
Simon
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---