Hi, thanks for your answers. Now i see whats the problem.
One more question. I mainly use numpy,scipy,f2py,cython from sage instead of python+numpy+scipy. Is it reasonable to set Realnumbers=float in each session? Or will this cause new problems? volker On 1 Sep., 22:11, Joshua Kantor <[EMAIL PROTECTED]> wrote: > Hello. I believe the issue is that earlier in the tutorial I had set > > sage: RealNumber=float > > but I didn't specify to reenter this in the section you were looking > at. > > If you enter this before the example it will work fine. The issue is > that as > William indicated, if you do not do this, instead of numpy floats in > x, you get sage reals > which are not as fast and don't work with numpy. I will look over the > tutorial, but there may be some more instances > where I forgot to re-specify that this needed to be entered. > > You may also wish to note that I have a slightly newer version of the > notes here on my > webpagehttp://www.math.washington.edu/~jkantor/Numerical_Sage/Numerical_Sage... > > which is a bit ahead of the one in sage documentation (I need to > update it). > > Josh > On Aug 31, 1:50 pm, William <[EMAIL PROTECTED]> wrote: > > > 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 sage-support@googlegroups.com 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/ -~----------~----~----~----~------~----~------~--~---