not log2(10) but log(10,2) {{{ R = RealField(round(log(10,2)*200)) len(str(R(pi))) /// 200 }}}
On 4/17/07, Timothy Clemans <[EMAIL PROTECTED]> wrote: > I'm confused about what to do. > > {{{ > R = RealField(round(log2(10)*200)) > len(str(R(pi))) > /// > 42 > }}} > > It would be nice if there was a SAGE way to easily get pi to say 200 > binary places or 200 decimal places. > > maybe: > pi.str(2,places=200) > > On 4/17/07, William Stein <[EMAIL PROTECTED]> wrote: > > > > On 4/17/07, Timothy Clemans <[EMAIL PROTECTED]> wrote: > > > > > > http://www.sagemath.org/hg/sage-main?f=258cf90b118f;file=sage/functions/constants.py > > > > > > "We can obtain floating point approximations to each of these constants > > > by coercing into the real field with given precision. For example, to > > > 200 decimal places we have the following: " > > > > That's a mistake in the documentation -- replace "decimal places" by > > "binary digits". To get n digits you need just over log_2(10) binary > > digits. > > > > > > > > I have done some tests. R = RealField(200); len(str(R(pi))) "is not > > > around 200" > > > > > > > > > {{{ > > > R = RealField(100) > > > print len(str(R(pi))) > > > print len(str(R(e))) > > > R = RealField(200) > > > print len(str(R(pi))) > > > print len(str(R(e))) > > > R = RealField(300) > > > print len(str(R(pi))) > > > print len(str(R(e))) > > > R = RealField(400) > > > print len(str(R(pi))) > > > print len(str(R(e))) > > > /// > > > 30 > > > 30 > > > 60 > > > 60 > > > 91 > > > 91 > > > 121 > > > 121 > > > }}} > > > > > > So now how do I get the decimal expansion of say pi to 200 places?\ > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---