Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Topic: Pi for a beginner - easy one!
Replies: 29   Last Post: Jun 6, 2000 8:22 AM

 Messages: [ Previous | Next ]
 Hermann Kremer Posts: 380 Registered: 12/8/04
Re: Pi for a beginner - easy one!
Posted: Jun 1, 2000 3:51 PM

Charles H. Giffen schrieb in Nachricht <39367795.8EB3491@virginia.edu>...
>Mike Mccarty Sr wrote:
>>
>> In article <393460D7.42F4@pointecom.net>,
>> Lynn Killingbeck <killbeck@pointecom.net> wrote:
>>
>> )Use a search engine (e.g., http://www.yahoo.com/) to find already
>> )computed values of PI to lots of digits. Try search keywords such as
>> )"PI", "digits", or such. I found one with 50,000 or so a while back, and
>> )there are more readily available. At least one of these will a pointer
>> )to the world-record with several billions of digits. Don't even think
>>
>> It should be easy to compute, Lynn. 100,000 digits can be attained just
>> by Machin's formula
>>
>> PI = 16 atan(1/5) - 4 atan(1/239)
>>
>> 1,000,000 can be computed on most desktop machines in an hour or so,
>>

In
http://www.snippets.org
are several cute little C programs (Machin and AGM) using simple home-made
extended precision fixed point arithmetic and computing pi up to several
thousand
digits. Prefer PI8.C and PI_AGM.C
Have fun
Hermann
--

>> )PI is not rational; therefore, not rational in any number system. I'll
>> )leave you to ponder what this may (or may not!) mean, since PI=1 in
>> )base_PI arithmetic.
>> )
>> )For converting among bases, I'd search for some arbitrary arithmetic
>> )package. They get mentioned fairly often in sci.math.num-analysis. I
>> )don't know which, if any, handle arbitrary precision fractions (rather
>> )than integers). Again, use a search engine, with keywords such as "high
>> )precision", "big number", "bignum", "arbitrary precision". See if you
>> )can find one that includes arbitrary bases for the input/output.
>>
>> Not necessary. Just compute integer(PIxBase^SomePower). Integer routines
>> suffice. I wouldn't bother to convert to another base; I'd do the
>> computation in the other base.
>>
>> Mike
>> --
>> ----
>> char *p="char

*p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
>> This message made from 100% recycled bits.
>> I don't speak for Alcatel <- They make me say that.

>
> If you want to go a little faster, use Euler's arctangent series:
>
> arctan(x) =

(
> 4^j*j!^2*x^(2*j + 1)/((2*j + 1)!*(1 + x^2)^(j+1)),
> j = 0 .. infinity)
>
> = x/(1+x^2)+2*x^3/(3*(1+x^2)^2) +
> 2*4*x^5/(3*5*(1+x^2)^3) +
> 2*4*6*x^7/(3*5*7*(1+x^2)^4) + ... ,
>
>which converges for all x and for abs(x) <= 1 converges much more
>rapidly than the Taylor series for the arctangent.
>
> The error E[n](x) in using the first n terms (the zero-th
>through (n-1)-st terms) satisfies the inequality:
>
> |E[n](x)| <= 4^n*n!^2*|x|^(2*n + 1)/((2*n + 1)!*(1 + x^2)^n),
>
>so one can readily determine just how many terms to use in calculating
>an arctangent by Euler's series.
>
> Euler discovered the formula
>
> Pi = 20*arctan(1/7) + 8*arctan(3/79) ,
>
>and used his arctangent series along with this formula to compute 20
>digits of Pi by hand in under an hour. Incidentally, the particular
>formula Euler used in computing Pi works rather well for hand
>calculation, since the quantity x^2/(1+x^2) is quite manageable
>when x = 1/7 or 3/79, as you can see for yourself.
>
>--Chuck Giffen

Date Subject Author
5/30/00 Martin Spencer
5/30/00 Dann Corbit
5/30/00 Martin Spencer
5/31/00 Simon de Vet
5/31/00 Simon Kristensen
5/31/00 Steve Monson
5/30/00 Lynn Killingbeck
5/31/00 Mike Mccarty Sr
6/1/00 G. A. Edgar
6/2/00 Mike Mccarty Sr
6/5/00 Dan Stratila
6/5/00 Mike Mccarty Sr
6/5/00 Lynn Killingbeck
6/5/00 Clive Tooth
6/1/00 Charles H. Giffen
6/1/00 Hermann Kremer
6/2/00 Mike Mccarty Sr
5/31/00 Nico Benschop
6/1/00 Martin Spencer
6/2/00 Clive Tooth
6/6/00 Gerry Myerson
6/6/00 Clive Tooth
6/6/00 Dik T. Winter
6/6/00 Clive Tooth
6/2/00 don mcdonald
5/31/00 Clive Tooth
6/1/00 Martin Spencer
6/1/00 Martin Spencer
6/1/00 Dan Stratila
6/1/00 Martin Spencer