Yes, I am calling Scipy functions from a standard Python, thus no preparser. It does not recognize 1r, 10r, etc. Is there anyway to get it to work? I have also tried R, but r.binom does not work.
On Jul 6, 3:16 pm, Ahmed Fasih <wuzzyv...@gmail.com> wrote: > 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 <thephantom6...@hotmail.com> 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-Hidequoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show 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 -~----------~----~----~----~------~----~------~--~---