18_dic

96 days ago by etlopez18

var('t,x') f(t,x)=e^t*(1+1/x) 
       
n=3 t0=1 tf=2 x0=4 
       
h=(tf-t0)/n.n() 
       
euler(t,x)=x+h*f(t,x) 
       
x1=euler(t0,x0).n(); x1 
       
5.13261742852460
5.13261742852460
x2=euler(t0+h,x1).n(); x2 
       
6.64354982464619
6.64354982464619
x3=euler(t0+2*h,x2).n(); x3 
       
8.67402547722230
8.67402547722230