The Maple notebook is chapt2_3_5.mw but you are warned that it may download as a text file.

More Pi

Machin's Approximation

The series partial(s) = 4*sum((-1)^k/(2*k+1),k=0..10^s) converges very slowly. To see how slowly, evaluate the sum for different values of the upper limit and compare to the true value pi = 3.14159265358979323846...  Note that the upper limit of the summation is 10^s, so partial(3) calculates the first 1000 terms, partial(4) calculates the first 10,000, and partial(5) the first 100,000.

 > partial := s -> evalf(4*sum((-1)^k/(2*k+1),k=0..10^s));

 > partial(3);

The Binomial Series Approximation

The approximation to pi given by equation (2.20) is encoded as BS(n). The last command plots 10 values of this function from n=10 to n = 100.

 > BS := n -> evalf( 10/3 - sum( (2*k-2)!/2^(2*k-1) / k! / (k-1)! / (2*k+1),k=2..n) );

 > BS(10);

 > BSList:= n -> [seq([floor(n*j/10),BS(floor(n*j/10))],j=1..10)];

 > plots[listplot](BSList(100));

Newton's Approximation

The approximation to pi given by Newton's formula is encoded as NS(n). The last command returns 10 values of the difference between this function and pi  from n=10 to n = 100.

 > NS := n -> evalf( 253/80 - sum( 6*(2*k - 3)!*(2*k + 7)/(16^k * k! *(k - 2)!*(2*k + 3)),k=2..n) );

 > NS(10);

 > NSList:= n -> [seq([floor(n*j/10),evalf(NS(floor(n*j/10))-Pi,100)],j=1..10)];

 > NSList(100);

Ramanujan's Approximation

Ramanujan's approximation is to 1/pi, but it is easy to take reciprocals and so obtain an approximation to pi. The function RS(n) calculates the sum up to n of Ramanujan's series.The last command returns 10 values of the difference between 1/RS(n) and pi  from n=10 to n = 100.

 > RS := n -> evalf(sqrt(8)*1103/9801,100) + evalf(sqrt(8)/9801*sum((4*k)!*(1103 + 26390*k)/(k!)^4/396^(4*k),k=1..n),100) ;

 > RSList:= n -> [seq([floor(n*j/10),evalf(1/RS(floor(n*j/10))-Pi,100)],j=1..10)];

 > RSList(10);