1
$\begingroup$

I'm trying to evaluate the first derivative of the period-3 logistic map for the fixed points in the period 3 window at a specific value of r. I define the period-3 map:

f[r_, x0_] := r*(r*(r*x0(1-x0))*(1-(r*x0(1-x0))))*(1-r*(r*x0 (1-x0))*(1-(r*x0 (1-x0))));

and the derivative of the map:

F1p[r, x0] := Derivative[2, 0][f][r, x0];

Then I get the fixed points at a specified value of r:

s = Solve[f[3.835, x0] == x0 && x0 > 0 , {x0}]

and put these values into a list (table)?:

xx = s[[All, 1, 2]]

What I'm trying to do next is get each fixed point and evaluate the derivative, but the code just outputs the function call and not the output value:

For[i = 1, i < Length[xx], i++, Print[Evaluate[F1p[3.835, xx[[i]]]]]]

outputs something like:

F1p[3.835,0.152074]

I also just tested my derivative function, and it looks like that is giving the same output as well. What am I doing wrong here?

$\endgroup$

1 Answer 1

2
$\begingroup$

In the definition of F1p its arguments need to be patterns.

Clear[f, F1p]

f[r_, x0_] := 
  r*(r*(r*x0 (1 - x0))*(1 - (r*x0 (1 - x0))))*(1 - 
     r*(r*x0 (1 - x0))*(1 - (r*x0 (1 - x0))));

F1p[r_, x0_] = Derivative[2, 0][f][r, x0] // Simplify;

xx = x0 /. Solve[f[3.835, x0] == x0 && x0 > 0, {x0}]

(* {0.152074, 0.167205, 0.494514, 0.534015, 0.739244, 0.954313, 0.958635} *)

F1p[3.835, #] & /@ xx

(* {-0.530149, -0.148339, -9.079, -8.66445, 0.816794, -0.526866, -0.415777} *)
$\endgroup$
3
  • $\begingroup$ You can also do F1p = Derivative[2, 0][f], although then it is a bit harder to simplify. $\endgroup$
    – Carl Woll
    Commented Apr 18, 2018 at 4:06
  • $\begingroup$ Bob, did you use Set instead of SetDelayed in the definition of F1p for a purpose? I'd have used F1p[r_, x0_] := Evaluate[Simplify[Derivative[2, 0][f][r, x0]]]; $\endgroup$ Commented Apr 18, 2018 at 6:08
  • $\begingroup$ @HenrikSchumacher - yes it was deliberate -- to avoid the necessity of using Evaluate $\endgroup$
    – Bob Hanlon
    Commented Apr 18, 2018 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.