MatLab Assignment 8 --
Turn in on November 7
We know that tan-1 = x - x3/3 + x5/5
- ... (-1)k+1 x2k-1/(2k-1) ..., |x| <= 1.
- Create a MatLab function which computes the partial sum
SN = x - x3/3 + x5/5
- ... (-1)N+1 x2N-1/(2N-1),
for a given positive integer N and a real number x in [-1,1].
- Test your function with N=16 and x=1/sqrt(3).
The answer is: 0.52359877528900. (Use
format long to see more digits.) If you multiple this number by 6, you get an
approximation of pi.
- Approximate pi by each of the following identities
with eight decimal digits accuracy.
For each case, determine first N using the convergence result for
alternating series; and report the approximation,
the integer N, and the true error (>> abs(pi-SN)).
- pi/4=tan-1(1)
- pi/4=tan-1(1/5)-tan-1(1/239)
- pi/4=12tan-1(1/18)+8tan-1(1/57)
-5tan-1(1/239)
- pi/4=6tan-1(1/8)+2tan-1(1/57)
+tan-1(1/239)