Here is something I noticed this weekend, running a worksheet I had
originally written in Sage 3.1 or 3.2 (I can't remember).

This gives an error:

sage: from scipy import stats
sage: stats.binom.pmf(5r,10r,0.5r)
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.bool_'

Of course, you can get around it as Jason suggested, or evaluating the
cells using %python

sage: %python
sage: stats.binom.pmf(5,10,0.5)
array(0.24609374999999978)

However, this is what looks strange now:

sage: type(5r)
<type 'sage.rings.integer.Integer'>
sage: type(5)
<type 'sage.rings.integer.Integer'>
sage: type(int(5))
<type 'int'>

So, it is not the interface with scipy/pylab that changed, but the way
literals such as 5r are interpreted by Sage.

On Tue, Mar 17, 2009 at 3:58 PM, Jason Grout
<[email protected]> wrote:
>
> Stan Schymanski wrote:
> > Dear all,
> >
> > Since version 3.3, the option "pylab.axis([xmin,xmax,ymin,ymax])"
> > leads to an error. Does anyone know what is going wrong there and how
> > to get around it?
> >
> > Example generated in a Sage 3.4 notebook:
> >
> > import pylab
> > pylab.clf()
> > pylab.figure(1)
> > pylab.plot([0,1,2],[0,1,2],'b+')
> > pylab.axis([0,3,0,3])
>
>
> Try:
>
> pylab.axis([int(0), int(3), int(0), int(3)])
>
> Does it work now?
>
> Again, I think this is the problem that numpy/scipy doesn't play well
> with Sage integers and is expecting python integers.
>
>
> Jason
>
>
>
> > pylab.savefig('foo.png')
> >
> > Traceback (click to the left for traceback)
> > ...
> > TypeError: function not supported for these types, and can't coerce
> > safely to supported types
> >
> >
> > Thanks already for your help!
> >
> > Cheers,
> > Stan
> > >
> >
>
>
> >



--
"The main things which seem to me important on their own account, and
not merely as means to other things, are knowledge, art, instinctive
happiness, and relations of friendship or affection."
  -Bertrand Russell

L. Felipe Martins
Department of Mathematics
Cleveland State University
[email protected]

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to