[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:22:14 CST 2007

On 1/21/07, Dick Moores <rdm at rcblue.com> wrote:

> OK, I'll reclarify. Of course, I'm trying to learn clnum. I thought
> that was understood. Please show me how to use clnum to compute
> (5/23)**(2/7) (that's 5/23  to the  2/7 power), with a precision of
> 50. Surely the answer is not
> mpf('0.06211180124223602484472049689440993788819875776397515527949',55)??
> Just by inspection this is clear, is it not? A number between 0 and 1
> raised to a power between 0 and 1 will get closer to 1, right? (5/23
> is 0.217391304348) I believe you've given me (5/23.)*(2/7.).

Sorry, my bad: one misplaced parenthesis and me being terribly sloppy
in not actually checking the numerical value (I just hastily saw
0..6.. and didn't look further).

In [2]: import clnum as n

In [3]: n.set_default_precision(50)

This is what I repeated to you like a mindless idiot:

In [4]: n.exp(n.log(n.mpq('5/23')*n.mpq('2/7')))
Out[4]: mpf('0.06211180124223602484472049689440993788819875776397515527949',55)

This is the correct form (note position of parenthesis):

In [5]: n.exp(n.log(n.mpq('5/23'))*n.mpq('2/7'))
Out[5]: mpf('0.6466073240654112346263901524238077888294103593272266200345',55)

Again, my apology for the confusion, it was entirely my fault.



More information about the SciPy-user mailing list