# Metoda raspolavljanja

f(x):=x^3+3*x^2-x+5;

solve(f(x)=0,x);

rectform(float(%));

a:-5.0 $
b:-1.0 $
epsilon: 10^(-15) $
while ((b-a)>=epsilon) do 
( c: (a+b)/2,
  if f(a)*f(c)<0 then (b:c) else (a:c)
)$
c: (a+b)/2;

f(x):=x*%e^x-1;

solve(f(x)=0,x);

wxplot2d(f(x),[x,0,1]);

a:0.0 $
b:1.0 $
epsilon: 10^(-15) $
while ((b-a)>=epsilon) do 
( c: (a+b)/2,
  if f(a)*f(c)<0 then (b:c) else (a:c)
)$
c: (a+b)/2;

find_root(f(x)=0,x,0,1);