The reciprocal Fibonacci constant is defined by the infinite sum: psi = sigma^in
ID: 2080637 • Letter: T
Question
The reciprocal Fibonacci constant is defined by the infinite sum: psi = sigma^infinity_ n = 1 1/F_n Where F_ n are the Fibonacci numbers 1, 1, 2, 3, 5, 8, 13, .... Each element in this sequence of numbers is the sum of the previous two. Write a MATLAB program in a script file that calculates the first hundred Fibonacci numbers F_ n. Start by setting the first two elements in F_ n series equal to 1, then determine the series F_ n up to n = 100. Then find the value of the constant psi for n = 10 to 100 with an increment of 10. The program must display the result using fprintf as: The Fibonacci constant for n = XXX is XXXXX The Fibonacci constant for n = XXX is XXXXX where XX is the value of n used and XXXXX is the value of the constant psi displayed in f format with 15 decimal digits. What do you conclude from your results?Explanation / Answer
(copy the following code to a new script file in MATLAB)
clc; close all; clear all;
F=[1,1,zeros(1,98)];
for i=1:98
F(i+2)=F(i)+F(i+1);
end
psi=0;
for n=10:10:100
psi=0;
for i=1:n
psi=psi+1/F(i);
end
fprintf('The Fibonacci constant for n = %d is %.15f ',n,psi);
end
It is observed that the value of reciprocal Fibonacci constant does not change as number of Fibonacci numbers (n) is increased beyond n=80. The constant saturates at n=80 with value 3.359885666243178.
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.