Hello. Feigenbaum delta from the logistic map. Been stuck for hours and i dont know how to solve it. Please tell me my mistake and if its completly wrong please tell me

26 visualizzazioni (ultimi 30 giorni)
THE QUESTION
Compute the Feigenbaum delta from the logistic map. The logistic map is given by
,
and the Feigenbaum delta is defined as
where
and where is the value of μ for which is in the orbit of the period-N cycle with .
Here is a resonable outline:
Loop 1 Start at period- with , and increment n with each iteration
Compute initial guess for using , and .
Loop 2 Iterate Newton's method, either a fixed number of times or until convergence
Initialize logistic map
Loop 3 Iterate the logistic map times
Compute x and
Loop 3 (end)
One step of Newton's method
Loop 2 (end)
Save and compute
Loop 1 (end)
Grading will be done on the converged values of up to . Set .
clc
clear all;
start_time = clock;
a0 = 2; a1 = 1+ sqrt(5); d=4;
mu(1)=a0;
mu(2)=a1;
for k = 3:15
a = a1 + (al-a0)/d;
for i = 1:2
res = 0.5; der = 0;
for j = 2:2^(k-1)+1
der = res*(1-res)+ a*(1-2*res)*der;
end
a= a-(res-0.5)/der;
end
%d = (a1-a0)/(a-a1); % approxima
fins a 4.66919841237705
d = (vpa(a1)-vpa(a0))/(vpa(a)-vpa(a1));
% approxima a 4.69201587522386
que, s clarament
millor
fprintf('Approximaci n mero % us %.15f/n', k,double(d));
a0 = a1,
a1 = a;
mu(k)=a;
end
end_time= clock;
total_time= end_time-start_time
  2 Commenti
Dyuman Joshi
Dyuman Joshi il 22 Gen 2024
What is the expected output from the question?
Is it a script-based problem or a function-based problem?
Also, some pointers for the code -
> You don't need to use vpa() here, so remove it.
> tic-toc will be a better fit here instead of clock
However, is it necessary to calculate the time taken by the code in the question?

Accedi per commentare.

Risposte (1)

Vinayak
Vinayak il 19 Gen 2024
Hi,
After analysing your code and the required map, I found a few issues. It is my understanding that you are referring to variable ‘a1’ instead of ‘al’ inside the for loop. I have modified the calculation of “d” according to the equation shared. Here is the updated code:
clc
clear all;
start_time = clock;
a0 = 2; a1 = 1 + sqrt(5); d = 4;
mu = zeros(1, 15); % Initialize mu array
mu(1) = a0;
mu(2) = a1;
for k = 3:15
a = a1 + (a1 - a0) / d;
for i = 1:2
res = 0.5; der = 0;
for j = 2:2^(k - 1) + 1
der = res * (1 - res) + a * (1 - 2 * res) * der;
end
a = a - (res - 0.5) / der;
end
% Corrected indexing for mu array
d = (mu(k-1) - mu(k-2)) / (mu(k) - mu(k-1));
fprintf('Approximation number %d is %.15f\n', k, double(d));
a0 = a1;
a1 = a;
mu(k) = a;
end
end_time = clock;
total_time = etime(end_time, start_time);
fprintf('Total time: %f seconds\n', total_time);
The above updated code correctly computes the Feigenbaum delta from the logistic map.
Hope this helps!
  3 Commenti
Dyuman Joshi
Dyuman Joshi il 22 Gen 2024
@food lover, There is no "num_doublings" parameter in the answer above, nor is there a for loop with n as the loop index.
So the error does not stem from the code given by @Vinayak.
Unless we know what code you have provided as the solution and what exactly is the question asking, it is difficult to provide any suggestions.

Accedi per commentare.

Categorie

Scopri di più su Matrix Computations in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by