Compute pi to base 12 using Python?
Dick Moores
rdm at rcblue.com
Wed Apr 13 21:56:45 EDT 2005
Paul Rubin wrote at 18:20 4/13/2005:
>Dick Moores <rdm at rcblue.com> writes:
> > I need to figure out how to compute pi to base 12, to as many digits
> > as possible. I found this reference,
> > <http://mathworld.wolfram.com/Base.html>, but I really don't
> > understand it well enough. Could someone show me how to do what I need?
>
>Using the GNU "bc" utility:
>
> $ bc -l
> bc 1.06
> Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
> This is free software with ABSOLUTELY NO WARRANTY.
> For details type `warranty'.
> scale = 3000 # number of output places wanted
> obase = 12 # output base
> print 4 * a(1) # pi = 4*arctan(1)
I don't believe GNU "bc" is available for Windows, is it?
Thanks,
Dick Moores
rdm at rcblue.com
More information about the Python-list
mailing list