Maybe you can use:

sage: RealNumber=float; Integer=int

or, explicitly define the number type when calling the scipy function.

Good luck,

Kevin Horton

On 6 Jul 2009, at 15:57, Mikie wrote:

>
> Ahmed,
>
> Looks good, but I am creating a function in python that is called.
> And 1r, .56r ,etc. does not pass.  I am taking these parameters from a
> form and then using the function.
> Is there a work-a-round?
> Thanks
>
>
> On Jul 3, 6:19 pm, Ahmed Fasih <wuzzyv...@gmail.com> wrote:
>> This is also an excellent resource: "How To Ask Questions The Smart
>> Way," by the peerless Eric Steven 
>> Raymond:http://catb.org/esr/faqs/smart-questions.html
>>
>> On Jul 3, 8:17 pm, Ahmed Fasih <wuzzyv...@gmail.com> 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 
>>> inhttp://wiki.sagemath.org/faq#Typeissuesusingscipy.2Ccvxoptornumpyfrom 
>>> ...
>>
>>> 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
>>
>>> As an alternative, if you plan on doing everything in Scipy/Numpy  
>>> and
>>> don't mind a fat-fisted approach, you may want to use IPython in  
>>> Pylab
>>> mode: start Sage with "sage -ipython -pylab" and you don't have to
>>> worry about the preprocessor.
>>
>>> On Jul 3, 3:30 pm, Mikie <thephantom6...@hotmail.com> wrote:
>>
>>>> I am trying to use the binomial pmf function in Scipy.  Forget the
>>>> question I will write my own.
>>>> Thanx
>>
>>>> On Jul 3, 9:32 am, William Stein <wst...@gmail.com> wrote:
>>
>>>>> On Fri, Jul 3, 2009 at 5:27 PM,  
>>>>> Mikie<thephantom6...@hotmail.com> wrote:
>>
>>>>>> What is the syntax to get the binomial function in Scipy to  
>>>>>> calculate?
>>>>>> I have tried stats.binom.pmf(1,10,.56,0) etc.
>>>>>> Thanks  for the help.
>>
>>>>> (1) I don't understand the question.  What does your question  
>>>>> mean?
>>
>>>>> (2) Possibly you should also ask on the scipy support list, where
>>>>> there are likely to be more scipy experts...
>>
>>>>> --
>>>>> William Stein
>>>>> Associate Professor of Mathematics
>>>>> University of Washingtonhttp://wstein.org- Hide quoted text -




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