Hi,

This is an issue with the preparser and numpy not playing well
together.  E.g., if you do this it works fine:

sage: preparser(False)
sage: import numpy
sage: j=numpy.complex(0,1)
sage: num_points=50
sage: u=numpy.zeros((num_points,num_points),dtype=float)
sage: pi_c=float(pi)
sage: x=numpy.r_[0.0:pi_c:num_points*j]
sage: u[0,:]=numpy.sin(x)

Note that the command "preparser(False)" isn't supported in the
notebook yet.  You %python or
switch to python mode.

In the long run we hope to improve numpy / SAGE interaction.

On Aug 30, 1:03 am, legout <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i´ve got the following problem on my sage installation.
> The folloing code 
> fromhttp://www.math.washington.edu/~jkantor/Numerical_Sage/node11.html
> Didn´t work for me:
>
> import numpy
> j=numpy.complex(0,1)
> num_points=50
> u=numpy.zeros((num_points,num_points),dtype=float)
> pi_c=float(pi)
> x=numpy.r_[0.0:pi_c:num_points*j]
> u[0,:]=numpy.sin(x)
> ---------------------------------------------------------------------------
> <type 'exceptions.AttributeError'>        Traceback (most recent call
> last)
>
> /home/volker/<ipython console> in <module>()
>
> <type 'exceptions.AttributeError'>: 'float' object has no attribute
> 'sin'
>
> I can use this (its the same, because sin(x[-1])=0)
>
> u[0, :-1]=numpy.sin(x[ :-1])
>
> And using real instead of float, and everything works as aspected
>
> pi_c = real(pi)
> x=numpy.r_[0.0:pi_c:num_points*j]
> u[0,:]=numpy.sin(x)
>
> Is this a bug in sage? On my normal python + numpy session the first
> code runs just find.
>
> volker


--~--~---------~--~----~------------~-------~--~----~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to