On Thu, Jul 9, 2009 at 12:12 PM, William Stein<wst...@gmail.com> wrote:
> On Thu, Jul 9, 2009 at 12:02 PM, William Stein<wst...@gmail.com> wrote:
>> On Thu, Jul 9, 2009 at 11:31 AM, Mikie<thephantom6...@hotmail.com> wrote:
>>>
>>> Robert,  how do I update my sage installation when you create a
>>> patch.  Do I have to reinstall Sage?
>>> Thanx
>>
>> I just did
>>
>> sage: 
>> hg_sage.apply('http://trac.sagemath.org/sage_trac/attachment/ticket/5081/5081-numpy-types.patch')
>>
>> sage: quit
>>
>> sage -br
>>
>> ...
>>
>> sage: import numpy
>> sage: numpy.array([1,2,3]).dtype
>> dtype('int64')
>>
>> w00t!
>>
>> William
>>
>
> And the patch works, in that not only does numpy now work, but the
> original problem that started this thread is resolved:
>
> sage: scipy.stats.binom.pmf(1,10,.56,0)
> 0.0034614823012532187
>
> However, this works
>
> sage: scipy.stats.binom.pmf(1,10,.560000000000000000000,0)
> 0.0034614823012532187
>
> but this doesn't:
>
> sage: scipy.stats.binom.pmf(1,10,.56000000000000000000000000000000000000,0)
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
>
> /Users/wstein/.sage/temp/teragon_2.local/93783/_Users_wstein__sage_init_sage_0.py
> in <module>()
>
> /Users/wstein/build/64bit/sage-4.1/local/lib/python2.6/site-packages/scipy/stats/distributions.py
> in pmf(self, k, *args, **kwds)
>   3883         output = zeros(shape(cond),'d')
>   3884         place(output,(1-cond0)*(cond1==cond1),self.badvalue)
> -> 3885         goodargs = argsreduce(cond, *((k,)+args))
>   3886         place(output,cond,self._pmf(*goodargs))
>   3887         if output.ndim == 0:
>
> /Users/wstein/build/64bit/sage-4.1/local/lib/python2.6/site-packages/scipy/stats/distributions.py
> in argsreduce(cond, *args)
>    246         # make sure newarr is not a scalar
>    247         newarr = atleast_1d(args[k])
> --> 248         newargs[k] = extract(cond,newarr*expand_arr)
>    249     return newargs
>    250
>
> TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 
> 'numpy.bool_'
>

I can see that the above failing is by design (in the source code),
and seems sensible to me.

 -- William

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