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

조회 수: 25 (최근 30일)
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
Dyuman Joshi
Dyuman Joshi 2024년 1월 22일
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?
food lover
food lover 2024년 1월 22일
Feigenbaum delta = 4.669201609102047
script based
and yes i believe so

댓글을 달려면 로그인하십시오.

답변 (1개)

Vinayak
Vinayak 2024년 1월 19일
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
Dyuman Joshi
Dyuman Joshi 2024년 1월 22일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Computations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by