//methode de tir nonlineaire avec secante
//equation T"= alpha T^4

// CL: T(a) et T'(b)=0 fixees


function DU=systeme(t,U),

DU(1) = U(2);
DU(2)= alpha*U(1)^4;
endfunction;



//prog principal

N=1000;
h=0.0015/N;
x=[0:h:0.0015];

alpha=0.00001;



/////CL:  T(0)=TO et T'(0.0015)=0; /////

T0=1000;


// sol avec U0=[T0 0]';

 beta0=100.;
 beta1=1.001*beta0;
 
 U0=[T0 beta0]';
 U1=[T0 beta1]';

 Y0=ode("rk",U0,0.,x,systeme);

err=1000;

 while err>0.01,

  Y1=ode("rk",U1,0.,x,systeme);
  g0=Y0(2,$);
  g1=Y1(2,$);

  beta2= beta1 - g1*(beta1-beta0)/(g1-g0);

  beta2
  
  beta0=beta1;
  beta1=beta2;
  
  Y0=Y1;
  U1=[T0 beta1]';
  err=abs(Y1(2,$));
 end;

 xset("window",1);
   clf();
   title(" solution CL1: Y1");
   plot2d(x,Y1(1,:));

   Y1(2,$)

   beta1

