kill(all)$

maxima : plot staircase and evolution, g(x) =x , version 1.0a
peter.vlasschaert@gmail.com,08/09/2022

staircase : 
f(x) = x-co(x) , x=g(x) = cos(x) =F 

→ F

p1:cos(x);

syntax :Function: staircase (F, y0, n,options,…);
→  y(n+1) = F(y(n)),recurrence relation 
-------------------------------------------------------------
result . n=0 ,start value => y(1) ,n=0,1,2,.....

→ y(0)  : start value :

p1a:1;

→ number recurrence  to draw: n

p1b:11;

result : range to find intersect (red,green)
------------------------------------------------------
x        = green
cos(x) = red
blue    = start value  to the intersect value when find value.

p1c:[x,0,2];

final plot : staircase

p1d:staircase(p1,p1a,p1b,p1c);

reason : floating graph , copy the graph to the clipboard
-------------------------------------------------------------------------
gnuplot ,choose first drop down menu above the plot

x-axis = x(n), y-axis = x(n+1)

evolution : 1D
f(x) = x-co(x) , x=g(x) = cos(x)

syntax ;evolution (F, y0, n, …, options, …), see above
rem : options is same plot2d.

p2:evolution(p1,p1a,50);/* n=50*/

 x-axis = n, y-axis = x(n)

when :  n-> ∞ , you get value below → see : see numerical methods. "p3c1"

rem : evolution :2d
------------------------
Function: evolution2d ([F, G], [u, v], [u0, y0], n, options, …)
→   u(n+1) = F(u(n), v(n))    v(n+1) = G(u(n), v(n))
(%i1) f: 0.6*x*(1+2*x)+0.8*y*(x-1)-y^2-0.9$
(%i2) g: 0.1*x*(1-6*x+4*y)+0.1*y*(1+9*y)-0.4$
(%i3) evolution2d([f,g], [x,y], [-0.5,0], 50000, [style,dots])
ref  :https://docs.huihoo.com/lisp/maxima/5.39.0/maxima_54.html#SEC263

computation:
==========

Exact : ( see : Menu → Equations→ Solve(to_poly)
--------

p3a:solve(x-cos(x)=0,x);

p3b:to_poly_solve([x-cos(x)], [x]);

Numerical :
---------------

Function: find_root (expr, x, a, b, [abserr, relerr])
Function: find_root (f, a, b, [abserr, relerr])
Function: bf_find_root (expr, x, a, b, [abserr, relerr])
Function: bf_find_root (f, a, b, [abserr, relerr])
Option variable: find_root_error
Option variable: find_root_abs
Option variable: find_root_rel

ref:https://maxima.sourceforge.io/docs/manual/maxima_110.html

→ x =intersect(green graph,red graph)

p3c:print("x = ",find_root (x-cos(x), x, 0.0, 2.0))$

→ evolution 1D ("recurence")

p3c1.print("x(n) = ",find_root (x-cos(x), x, 0.0, 2.0))$

-----------------------------------------------------------------------------------------------------------------------------