% Combining Archimedes method for approximating
% Pi and Richardson extrapolation.
% See Exercise 8.15 on p.377 Heath.
% Half of the perimeter of an inscribed polygon
% with n sides: pn = n*sin(pi/n)
% Half of the perimeter of an circumscribed polygon
% with n sides: qn = n*tan(pi/n)
% RESULT:
% Pip = 3.14107
% Piq = 3.1325
% NOTE: for n = 120, pn = n*sin(pi/n) = 3.14123
% qn = n*tan(pi/n) = 3.14231
% K. Ming Leung, 04/07/03

clear all; format short g;
p6=3.0000; p12=3.1058;
Pip=p6+(p6-p12)/(2^(-2)-1),
q6=3.4641; q12=3.2154;
Piq=q6+(q6-q12)/(2^(-2)-1),