|
Posted: 08/23/21
Due: 08/30/21, 11:55PM
Construct a convergence plot in logarithmic coordinates for the Leibniz series approximation of . Estimate the rate and order of convergence.
Solution. The convergence of the Leibniz series partial sum sequence
is shown in Fig. 1, and can be visually estimated to converge with order . The rate of convergence is
∴ |
N=200; n=20:20:N; |
∴ |
function Leibniz(n) k=0:n sum((-1).^k ./ (2*k.+1)) end |
Leibniz
∴ |
err=log.(abs.(Leibniz.(n) .- π/4)); |
∴ |
clf(); plot(log.(n),err,"-o"); xlabel("log(n)"); ylabel("log(err)"); title("Leibniz series convergence"); grid("on"); plot([3,4],[-5,-7],"-"); plot([3,4],[-5,-6],"-"); |
∴ |
savefig(homedir()*"/courses/MATH661/images/H01Fig01.eps") |
∴ |
Apply Aitken acceleration to the Leibniz partial sums sequence. Construct the convergence plot. Estimate the rate and order of convergence.
Solution. The Aitken-accelerated sequence has general term
with convergence plot shown in Fig. 2, indicating faster than quadratic growth.
∴ |
N=40; n=1:N; L=Leibniz.(n); A=copy(L); |
∴ |
for n=3:N ΔL = L[n] - L[n-1] Δ2L = L[n] - 2*L[n-1] + L[n-2] A[n] = L[n] - ΔL^2/Δ2L end |
∴ |
errL=log.(abs.(L .- π/4)); errA=log.(abs.(A .- π/4)); |
∴ |
clf(); plot(log.(n),errL,"-o"); plot(log.(n),errA,"-x"); xlabel("log(n)"); ylabel("log(err)"); title("Aitken-accelerated Leibniz series convergence"); grid("on"); plot([2,4],[-6,-8],"-"); plot([2,4],[-6,-10],"-"); |
∴ |
savefig(homedir()*"/courses/MATH661/images/H01Fig02.eps") |
∴ |
Construct a convergence plot for the Ramanujan series approximation of . Estimate the rate and order of convergence.
Solution. The general term
in the Ramanujuan series
decreases rapidly. Applying Stirling's formula (valid for large ), gives
Since , terms smaller than ( is machine epsilon) would not appreaciably contribute to the sum
∴ |
ε=eps(Float64); kmax = log(10^3*ε)/(-4*log(99)) |
∴ |
The above computation indicates that 2 terms of the sum should already give an approximation within machine precision.
∴ |
r(k) = factorial(4*k)*(1103.0+26390*k)/(factorial(k))^4/396^(4*k) |
r
∴ |
r.(1:5) |
(1)
∴ |
(4k)! (1103+26390k) |
(k!)4 3964k |
∴ |
N=200; n=20:20:N; |
∴ |
function Leibniz(n) k=0:n sum((-1).^k ./ (2*k.+1)) end |
Leibniz
∴ |
err=log.(abs.(Leibniz.(n) .- π/4)); |
∴ |
clf(); plot(log.(n),err,"-o"); xlabel("log(n)"); ylabel("log(err)"); title("Leibniz series convergence"); grid("on"); plot([3,4],[-5,-7],"-"); plot([3,4],[-5,-6],"-"); |
∴ |
savefig(homedir()*"/courses/MATH661/images/H01Fig01.eps") |
∴ |
Construct a convergence plot for the continued fraction approximation of . Estimate the rate and order of convergence.
Completely state the mathematical problem of computing the absolute value
Find the absolute and relative condition numbers.
Solution. According to Demmel [?]
Completely state the mathematical problem of computing a difference.
Find the absolute and relative condition numbers.