Fibonacci and Golden Ratio

One of the ways to compute the golden ration

4 Commenti

Andrew Newell
Andrew Newell il 4 Apr 2011
One way is to Google it (Google returns the answer).
Jan
Jan il 4 Apr 2011
Do you have a Matlab related question?
Jan
Jan il 4 Apr 2011
@Ashley: Don't give up: As soon as you edit the question and add any details - and a question! - you will get meaningful answers.
Is there any way to quantify the Golden mean of Image in MATLAB. Please help.

Accedi per commentare.

Risposte (5)

Clemens
Clemens il 17 Ago 2011
Actually the Golden Ratio is exactly:
( 1 + sqrt(5) ) / 2
so no need for iteration. Proof is easy through z-transform.

2 Commenti

Walter Roberson
Walter Roberson il 17 Ago 2011
But that gets back to my original answer, "The Golden Ratio is an irrational number, and thus an infinite number. It is not possible to compute its decimal expansion in a finite amount of time."
Jan
Jan il 17 Ago 2011
Fortunately the universe is finite. Therefore I do not believe, that an infinite number will match into it. While there is a minimal Planck length and a minimal Plank time, I propose a Planck eps for irrational numbers. According to Rupert Sheldrake, I claim that PI has as many numbers as has been calculated already. And after reading http://scientopia.org/blogs/goodmath/2010/12/08/really-is-wrong/ I'm not sure at all anymore about this fuzzy digits stuff.

Accedi per commentare.

Walter Roberson
Walter Roberson il 4 Apr 2011

0 voti

The Golden Ratio is an irrational number, and thus an infinite number. It is not possible to compute its decimal expansion in a finite amount of time.

8 Commenti

Jan
Jan il 4 Apr 2011
But if you have a sharp knife and a firm sausage, you can apply the golden section in a finite amount of time.
Matt Tearle
Matt Tearle il 4 Apr 2011
But the OP was asking for the golden ration, not the golden ratio. So I think Jan's right -- sausages might be necessary.
Walter Roberson
Walter Roberson il 4 Apr 2011
Not an option here, Jan -- I'm a vegetarian.
Walter Roberson
Walter Roberson il 4 Apr 2011
Matt: "Golden Ration" is clearly a Pale Ale or Bitter, not a sausage!
Sean de Wolski
Sean de Wolski il 4 Apr 2011
@Walter: you should make that an answer so we can vote for it!
Jan
Jan il 4 Apr 2011
Consider soya sausages. They are in the new Veggi-Toolbox of Matlab 2011a.
Sean de Wolski
Sean de Wolski il 4 Apr 2011
Soya sausages? That's like one term in the Taylor-series expansion of sausages.
Walter Roberson
Walter Roberson il 17 Ago 2011
Jan, Soya Beans used for the production of soya products are the dried fruit of the soya plant, and thus were not covered by the Veggi-Toolbox in R2011a (which, I understand, is still withheld from production due to legal battles over whether Tomatoes are fruits or vegetables....)

Accedi per commentare.

Walter Roberson
Walter Roberson il 4 Apr 2011
Let F(t) be Fibonacci number #t. Then
y = 100; %initial guess
x = (F(t+2) * y + F(t+1)) / (F(t+1) * y + F(t));
while x ~= y;
y = x;
x = (F(t+2) * y + F(t+1)) / (F(t+1) * y + F(t));
end
When the loop finishes (no more than a few centuries later, I'm sure), x and y will be the Golden ratio.

3 Commenti

Jan
Jan il 4 Apr 2011
Are you sure that x converges to a single value, or can it oscillate between two values due to floating point arithmetics?
Walter Roberson
Walter Roberson il 4 Apr 2011
Not completely certain. It worked for the F() values that I tried.
Jack Lê
Jack Lê il 17 Ago 2011
Thanks

Accedi per commentare.

fib=[0 1];
i=3;
while(i<=21)
fib(i)=fib(i-1)+fib(i-2);
gr=fib(i)/fib(i-1)
i=i+1;
end
gr = 1
gr = 2
gr = 1.5000
gr = 1.6667
gr = 1.6000
gr = 1.6250
gr = 1.6154
gr = 1.6190
gr = 1.6176
gr = 1.6182
gr = 1.6180
gr = 1.6181
gr = 1.6180
gr = 1.6180
gr = 1.6180
gr = 1.6180
gr = 1.6180
gr = 1.6180
gr = 1.6180
disp(fib)
Columns 1 through 16 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 17 through 21 987 1597 2584 4181 6765
% Function to calculate Fibonacci sequence up to a certain number of terms
function fib_sequence = fibonacci(n)
fib_sequence = zeros(1, n);
fib_sequence(1) = 0;
fib_sequence(2) = 1;
for i = 3:n
fib_sequence(i) = fib_sequence(i-1) + fib_sequence(i-2);
end
end
% Calculate the golden ratio using Fibonacci sequence
n = 20; % Number of Fibonacci terms to generate
fib_seq = fibonacci(n);
% Calculate the ratio of consecutive Fibonacci numbers
golden_ratio_approximations = fib_seq(3:end) ./ fib_seq(2:end-1);
% Display the approximations of the golden ratio
disp('Approximations of the golden ratio using Fibonacci sequence:');
Approximations of the golden ratio using Fibonacci sequence:
disp(golden_ratio_approximations);
1.0000 2.0000 1.5000 1.6667 1.6000 1.6250 1.6154 1.6190 1.6176 1.6182 1.6180 1.6181 1.6180 1.6180 1.6180 1.6180 1.6180 1.6180

Categorie

Scopri di più su Mathematics in Centro assistenza e File Exchange

Richiesto:

il 4 Apr 2011

Risposto:

il 16 Apr 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by