Simon King wrote:
> 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
> >
>
>
Hi,
Thanks for the reply. I tried using "I" but doesn't seem to work in
my context.
r, theta = var('r, theta')
x = r*cos(theta)
y = r*sin(theta)
z = exp(I*r*cos(theta)).real
parametric_plot3d( [x, y, z], (r, 0, 10), (theta, 0, 2*pi) )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sage/sagenb/sage_notebook/worksheets/mc0710/7/code/8.py", line
12, in <module>
parametric_plot3d( [x, y, z], (r, _sage_const_0 , _sage_const_10 ), (theta,
_sage_const_0 , _sage_const_2 *pi) )
File
"/home/sage/sage_install/sage-a/local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/",
line 1, in <module>
File "base.pyx", line 61, in sage.plot.plot3d.base.Graphics3d.__repr__
(sage/plot/plot3d/base.c:1973)
File "base.pyx", line 547, in sage.plot.plot3d.base.Graphics3d.show
(sage/plot/plot3d/base.c:9001)
File "base.pyx", line 318, in
sage.plot.plot3d.base.Graphics3d._prepare_for_jmol
(sage/plot/plot3d/base.c:5762)
File "base.pyx", line 333, in
sage.plot.plot3d.base.Graphics3d._box_for_aspect_ratio
(sage/plot/plot3d/base.c:6233)
File "base.pyx", line 108, in
sage.plot.plot3d.base.Graphics3d._safe_bounding_box
(sage/plot/plot3d/base.c:2740)
File "parametric_surface.pyx", line 174, in
sage.plot.plot3d.parametric_surface.ParametricSurface.bounding_box
(sage/plot/plot3d/parametric_surface.c:2133)
File "parametric_surface.pyx", line 213, in
sage.plot.plot3d.parametric_surface.ParametricSurface.triangulate
(sage/plot/plot3d/parametric_surface.c:2609)
File "parametric_surface.pyx", line 208, in
sage.plot.plot3d.parametric_surface.triangulate
(sage/plot/plot3d/parametric_surface.c:2551)
File "parametric_surface.pyx", line 395, in
sage.plot.plot3d.parametric_surface.ParametricSurface.eval_grid
(sage/plot/plot3d/parametric_surface.c:3978)
TypeError: real() takes exactly 1 argument (3 given)
Also I tried some basic stuff with "I" and it doesn't seem to be working.
sage: exp(I).real
<bound method SymbolicComposition.real of e^I>
Thanking you,
Mani chandra
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---