function y=f(x)
    y= x*x-1764;
endfunction

function [y,n]=Dichotomie(a,b,nmax,eps,f)
  y=a
   //deff('y=f(x)','y=x^4-10*x^3-15*x+24')
   if ((f(a)*f(b)>0)|(a>b)) then
     
    disp( 'Conditions initiales non valides ')
  else
  n=0;
  while ((n<nmax)&(abs(f(y))>eps))
    y=(a+b)/2
    if (f(a)*f(y)>0) then
      a=y
      elseif (f(a)*f(y)<0) then
      b=y
    else
      disp('Algorithme termin�, valeur exacte de y')
    end        
     n=n+1
   end  
end
endfunction


function [y,n]=corde(x0,a,b,nmax,eps,f)
   y=x0;
  n=0;
   while((n<nmax)&(abs(f(y))>eps))
     y=y-(f(y)*(b-a))/(f(b)-f(a))
     n=n+1
   end 
endfunction

  

  
function [y1,n]=Lagrange(x0,x1,nmax,eps,f)
  y0=x0;
  y1=x1;
 // deff('y=f(x)','y=x^4-10*x^3-15*x+24')
  n=0;
  while((n<nmax)&(abs(f(y1))>eps))
     a=y1    
     y1=y1-((f(y1)*(y1-y0))/(f(y1)-f(y0)))
     y0=a     
     n=n+1
   end  
endfunction

function [y,n]=RegulaFalsi(a,b,nmax,eps,f)
  
  y=a
   if (f(a)*f(b)>0) then
     
    disp( 'Conditions initiales non valides ')
  else
  n=0;
  while ((n<nmax)&(abs(f(y))>eps))
    y=a-((f(a)*(a-b))/(f(a)-f(b)))
    if (f(a)*f(y)>0) then
      a=y
    elseif (f(a)*f(y)<0) then
      b=y 
    else
        disp('valeur exacte de y')
    end        
     n=n+1
   end  
end
endfunction



function [y,n]=Newton(x0,nmax,eps,f,df)
  y=x0;

  n=0;
   while((n<nmax)&(abs(f(y))>eps))
     y=y-(f(y)/df(y))
     n=n+1
   end 
endfunction


   
