[SciPy-user] Can SciPy compute ln(640320**3 + 744)/163**.5 to 30 places?

Fernando Perez fperez.net at gmail.com
Sun Jan 21 23:01:20 CST 2007


On 1/21/07, Dick Moores <rdm at rcblue.com> wrote:
> At 08:01 PM 1/21/2007, you wrote:
> >On 1/21/07, Dick Moores <rdm at rcblue.com> wrote:
> > > Sorry, I replied to the wrong post. What I really want to see is how
> > > to use clnum to do (5/23)**(2/27).
> >
> >The answer was already in the message you quoted:
> >
> > > > >In [7]: n.exp(n.log(n.mpq('5/23')*n.mpq('2/7')))
> > > > >Out[7]:
> > > > >mpf('0.06211180124223602484472049689440993788819875776397515527949',55)
>
> No, think it's this:
>  >>>from __future__ import division
>  >>>(5/23)**(2/7)
> 0.64660732406541122
>
> No?

Well, since your question was:

> > > Sorry, I replied to the wrong post. What I really want to see is how
> > > to use clnum to do (5/23)**(2/27).

I gave you a clnum answer (with 2/7 instead of 2/27) (this assumes
"import clnum as n"):

n.exp(n.log(n.mpq('5/23')*n.mpq('2/7')))


Now, if your question had been

"What I really want to see is how to use /plain python/ to do (5/23)**(2/7)."

then the proper response would indeed be

In [1]: from __future__ import division

In [2]: (5/23)**(2/7)
Out[2]: 0.64660732406541122

or (without the __future__ statement):

In [1]: (5/23.)**(2/7.)
Out[1]: 0.64660732406541122


Regards,

f


More information about the SciPy-user mailing list