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

Robert Kern robert.kern at gmail.com
Mon Jan 15 03:06:01 EST 2007


Dick Moores wrote:

> Well if you mean for me to do:
> =============================
> # clnumTest1-b.py
> 
> import clnum as n
> 
> n.set_default_precision(50)
> 
> print n.log(640320**3 + 744)/n.sqrt(163)
> ==================================
> That gives me 3.1415926535897932385 .
> 
> So I STILL don't understand.

It looks like the __str__ representation of clnum numbers (i.e. what you get by
printing them, or by calling str() on them) is restricted to that many digits
regardless of what the actual precision of the object is. Look at the example at
the bottom of clnum's webpage:

  http://calcrpnpy.sourceforge.net/clnum.html

However, looking at the __repr__ representation (i.e. what was printed in the
Out[18] in the above example, and what can be obtained by calling repr() on the
object), you can see all of the digits that are available according to the
precision of the object.

> Also, what are those In [16]: things all you people use? Is that line
> 16? If so, line 16 of what?

It's just the IPython input prompt, like the >>> of the regular interpreter.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list