On Feb 15, 2008 1:35 PM, wdbragg <[EMAIL PROTECTED]> wrote: > > import pylab as p > x = p.arange(-100, 300, 10) > y = abs(x) > p.plot(x, y, 'go') > p.savefig('plot.png') > > This works as expected. However, if I change the function from abs to > cos... > > import pylab as p > x = p.arange(-100, 300, 10) > y = cos(x) > p.plot(x, y, 'go') > p.savefig('plot.png') > > This fails ... seems like a coercion problem. Can anyone tell me what > is wrong in the second case. I need to figure this one out.
Instead of writing y = cos(x) use y = p.cos(x) This will use the vectorized version of cos that is defined in pylab instead of the symbolic sage version of cos. (That said, I think it would be reasonable for us to change the Sage cos, etc., to call the vectorized versions included in numpy whenever a numpy array is given as input.) William --~--~---------~--~----~------------~-------~--~----~ 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---