Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

looking closely at the infinite series summation_n = 1^inifinity 1/n it would be

ID: 3676246 • Letter: L

Question

looking closely at the infinite series summation_n = 1^inifinity 1/n it would be reasonable (and correct) to conclude that it diverges. However, it may be surprising that the similar infinite series summation_n = 1^infinity 1/n^2 does not diverge, instead converging to a number (albeit irrational):pi^2/6 = 1.645. In similar fashion, when reciprocals of the factorials are added together, they also produce a series that converges to an important (and irrational i number with which you are probably familiar: e (Euler's number).summation_n - 0^infinity 1/n! = 1/1 + 1/1 + 1/2 + 1/6 +1/24 + = e = 2.718 Another convergent series is that of the reciprocals of the Fibonacci numbers, which sum to produce another irrational number called the reciprocal fibonacci constant. or psi. (As an aside, note that the Fibonacci series -and thus psi-an: intimately related to the golden ratio, phi = 1.61803.) Write a MATLAB script named PP 1_P3a that calls your function get_fac to estimate e. Write a MATLAB script named PP1_P3b that calls your function get._fib to estimate psi your estimate must to be at least 10 decimal places

Explanation / Answer

% get_fac.m file
a=0;
k=1;
out=0.0;
while 1/get_fib(k) > 1e-10
out = out+1/get_fib(k);
k=k+1;
end
format long;
out

% get_fib.m file
function [ output ] = get_fib( n )

if n==1
output=1;
elseif n==0
output=0;
  
else
a1=0;
a2=1;
i=1;
while i<n
a3 = a1+a2;
a1=a2;
a2=a3;
i=i+1;
end
output =a3;
end

end

% PP1_P3a.m file
a=0;
k=0;
out=0.0;
while 1/get_fac(k) > 1e-10
out = out+1/get_fac(k);
k=k+1;
end
format long;
out

% PP1_P3b.m file
a=0;
k=1;
out=0.0;
while 1/get_fib(k) > 1e-10
out = out+1/get_fib(k);
k=k+1;
end
format long;
out