I think I may have found a good argument to ask for better type
checking in scipy:

In [4]: stats.randint(1.,15.).ppf([.1,.2,.3,.4,.5])
Out[4]: array([ 2.,  3.,  5.,  6.,  7.])


when you call stats.randint with floats as parameters you get floats
as results, which is clearly wrong and should be fixed. Maybe the
solution to this may bring us closer to a general solution for the
incompatibility between sage types and Numpy/Scipy's.

I'll post this error to the numpy list and see what kind of response I
get.

Flávio

On 23 abr, 12:21, Flavio Coelho <fccoe...@gmail.com> wrote:
> On 23 abr, 11:47, William Stein <wst...@gmail.com> wrote:
>
>
>
> > > I tried to run the same module via load instead of import, but load
> > > was trying to load from the ~/.sage directory instead of the directory
> > > where I started sage, (is this a bug?).
>
> > No.
>
> then the "How to use the Sage Notebook" help page should be fixed
> because it says, and I quote:
>
> "Use "load filename.sage" and "load filename.py". Load is relative to
> the path you started the notebook in. The .sage files are preparsed
> and .py files are not. You may omit the .sage or .py extension. Files
> may load other files."
>
>
>
>
>
> > > Also load also gave me a
> > > syntax error when gave it a path : "load somedir/test.py". Shouldn't
> > > load take full paths instead of only filenames?
>
> > Yes.  That definitely sounds like a bug.  Thanks for reporting it.
>
> > > Flávio
> > >I think it will be hard to convice the scipy folks that this is a bug
> > > since it runs perfectly in Python, and scipy is not supposed to handle
> > > foreign types anyway...
>
> > Bug or not, at some point either the scipy/numpy developers or the
> > Sage developers will absolutely have to modify both scipy and numpy to
> > fix this problem.    Either that will happen via them better
> > supporting other data types besides float/int, or we will have to
> > significantly patch the versions of numpy/scipy that we ship with
> > Sage.   One or the other solution will inevitably happen.
>
> > William
>
> >  -- William
>
> What I did in my module, was to force every argument to
> stats.distribution and the .ppf call, to be floats whether they be
> ints or floats. That fixed it for now.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to