The following method of computing was discovered by Archimed
The following method of computing was discovered by Archimedes 1. let A = 1 and N = 6 2. Repeat 10 times, say:
a) Replace N by 2 N
b) Replace A by [2 -(4-A2)1/2]1/2
c) Let L=(N*A)/2
d) U= L / [(1-A2/2)1/2]
e) Let P = (U+L)/2
f) Let E= (U-L)/2
g) Print N, P, E
3) Stop
Write a program to implement the above algorithm using Matlab
Solution
A=1;
N=6;
for i= 1:10
N=2*N;
A = (2 - (4-2*A)/2)/2;
L= N*A/2;
U= L/((1-A*2/2)/2);
P=(U+L)/2;
E=(U-L)/2;
end
N
P
E
