Why am I getting error "Array indices must be positive" and error in syms, when using eval function
1 view (last 30 days)
Why am I getting errors when using the eval function?
f(x) = 3.5*x*(1-x)
f2 = f(f(x))
eqn2 = f2 == x;
I have used the same steps to evaluate f with no errors.
Any pointers would be really appreciated.
Highphi on 9 Feb 2022
I think it's because you need to make f, f2, and eqn2 functions of x (even though I drop eqn2)
syms x f f2 % << here
f(x) = 3.5*x*(1-x) % and see f(x) instead of just f
f2(x) = f(f(x)) % etc
% eqn2(x) = f2(x) == x %% not necessary
% sol = solve(eqn2, x) %% not necessary
sol = solve(f2(x) == x, x)