If you're calling Scipy functions from a standard Python environment,
you won't have the pre-processor issues, so I may be misunderstanding
what your underlying problem is.

Assuming you are in Sage (since this is a Sage mailing list) and
calling Scipy, other options that achieve the same effect as the raw
suffix were detailed on the FAQ: cast the types to float() explicitly,
turn off the pre-processor temporarily, redefine RealNumber() and
Integer() to float() and int(), etc. etc.

If none of these answer your question, please describe what you're
trying to do and what errors you are getting.

On Jul 6, 3:57 pm, Mikie <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> wrote:
>
> > > > > On Fri, Jul 3, 2009 at 5:27 PM, Mikie<[email protected]> 
> > > > > 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 -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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