kill(all)$

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

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

→ 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
x        = green
cos(x) = red
blue    = start vale  to the intersect value when find .

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

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

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

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)

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

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