Problem 3 (20 pts) Looking closely at the infinite series it would be reasonable
ID: 1716607 • Letter: P
Question
Problem 3 (20 pts) Looking closely at the infinite series it would be reasonable (and corect) to conclude that it diverges. However, it may be surprising that the similar infinite series does not diverge, instead converging to a number (albeit irrational): 1645. In similar fashion, when reciprocals of the factorials are added together, they also produce a series that converges to an important (and irrational) number with which you are probably familiar: e (Euler's number). =stst.. +-+-+-..=e n!1 1 26 24 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 . (As an aside, note that the Fibonacci series-and thus v-are intimately related to the golden rutio, ~ 1.61803.) (a) Write a MATLAB script named PP1 P3a that calls your function get fac to estimatee (b) Write a MATI AR script named PPI P3bthat calls your function get fib to estimate . Your estimates must be to at least 10 decimal places. (Hint: You'll need to set a tolerance in each script to determine when to finish refining its estimate and exit the loop.)Explanation / Answer
Main script file;
%clearing window, variables and figures
clc
clear all
close all
k=input(' Enter the value of k ');
c=get_fib(k);
fprintf(' The output:%.10f ',c);
Another script file saved as get_fib.m;
function F=get_fib(k)
c=1;
d(1)=0;
s=0;
for i=1:1:k
if d(i)==0
t=1;
s=1;
else
s=s+1/d(i);
end
if i==1 || i==2
d(i+1)=d(i)+t;
else
d(i+1)=d(i)+d(i-1);
end
end
F=s;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.