Ahmed Fasih wrote:
> Writing your own is a good way to understand the implementation issues
> that we sometimes unthinkingly rely on, but for production code, it's
> always a good idea to default to the pre-packaged implementation.
> 
> In this case, I think it's the standard issue with Scipy not
> understanding Sage types. This problem is described in
> http://wiki.sagemath.org/faq#Typeissuesusingscipy.2CcvxoptornumpyfromSage
> 
> sage: import scipy.stats as stats
> sage: stats.binom.pmf(1,10,.56,0)
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
> <snip>
> TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and
> 'numpy.bool_'
> 
> There are numerous fixes to this problem, one of which is:
> 
> sage: stats.binom.pmf(1r,10r,.56r,0r)
> 0.0034614823012532187


Robert Bradshaw just posted a patch to #5081 that makes this work:

sage: from scipy import stats
sage: stats.binom.pmf(1,10,.56,0)
0.0034614823012532187

(no preparser magic or anything; it just works).

And there was much rejoicing in the land!

Jason


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