Approximate the Zero of f(x) = exp(–x ) – cos(x)
that lies between x=1 and x=2
Define f as a function:
> f := x -> exp(–x) – cos(x) ;
Plot f(x) on the interval [0,4]:
> plot( f(x), x = 0.0 .. 4.0 );
Use fsolve to approximate the zero of f(x) that lies between x=1 and x=2:
> fsolve( f(x), x = 1.0 .. 2.0 ) ;
Store the result in z:
> z := fsolve( f(x), x = 1.0 .. 2.0 ) ;
Evaluate f(z) to see how close it is to 0:
> f(z);
This means –0.3 x 10–9, which is nearly 0 since, by default, Maple uses only 10 Digit arithmetic.