Vše o hromadné dopravě

A

with(NumericalMethods);

Digits:=25;

ODE:=diff(y(x),x)=-2*x*y(x);

IC:=y(0)=1;

sol:=exp(-x^2);

 

h:=0.05;

k:=0.005;

K:=0.0005;

 

Eh1:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=h, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=h, solution=sol, output=plot);

Ek1:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=k, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=k, solution=sol, output=plot);

EK1:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=K, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,3], stepsize=K, solution=sol, output=plot);

 

q11:=ln(Eh1/Ek1)/ln(h/k);

q12:=ln(Ek1/EK1)/ln(k/K);

 

Eh2:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=h, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=h, solution=sol, output=plot)

Ek2:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=k, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=k, solution=sol, output=plot);

EK2:=ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=K, solution=sol, output=totalerror);

ODENumeric(ODE, yinit=[1], x=0..3, method=[taylor,4], stepsize=K, solution=sol, output=plot)

 

q21 := ln(Eh2/Ek2)/ln(h/k);

q22 := ln(Ek2/EK2)/ln(k/K);

 

 

B

h := 0.5e-1; 
k := 0.5e-2; 
K := 0.5e-3
 
Eh1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,3],stepsize = h,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,3],stepsize = h,solution = sol,output = plot);
Ek1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,3],stepsize = k,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,3],stepsize = k,solution = sol,output = plot);
EK1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,3],stepsize = K,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,3],stepsize = K,solution = sol,output = plot);
 
q11 := ln(Eh1/Ek1)/ln(h/k);
q12 := ln(Ek1/EK1)/ln(k/K);
q13 := ln(Eh1/EK1)/ln(h/K);
 
Eh1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,4],stepsize = h,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,4],stepsize = h,solution = sol,output = plot);
Ek1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,4],stepsize = k,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,4],stepsize = k,solution = sol,output = plot);
EK1 := ODENumeric(ODE,yinit=[1],x=0..8,method=[taylor,4],stepsize = K,solution = sol,output = totalerror);
ODENumeric(ODE,yinit=1,x=0..8,method=[taylor,4],stepsize = K,solution = sol,output = plot);
 
 
q21 := ln(Eh2/Ek2)/ln(h/k);
q22 := ln(Ek2/EK2)/ln(k/K);
q23 := ln(Eh2/EK2)/ln(h/K);
Eh1:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=h, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=h, solution=sol, output=plot);
Ek1:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=k, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=k, solution=sol, output=plot);
EK1:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=K, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,3], stepsize=K, solution=sol, output=plot);
 
q11:=ln(Eh1/Ek1)/ln(h/k);
q12:=ln(Ek1/EK1)/ln(k/K);
 
Eh2:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=h, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=h, solution=sol, output=plot);
Ek2:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=k, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=k, solution=sol, output=plot);
EK2:=ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=K, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..8, method=[taylor,4], stepsize=K, solution=sol, output=plot);
 
q21 := ln(Eh2/Ek2)/ln(h/k);
q22 := ln(Ek2/EK2)/ln(k/K);
 
 
C
Eh1:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=h, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=h, solution=sol, output=plot);
Ek1:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=k, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=k, solution=sol, output=plot);
EK1:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=K, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,3], stepsize=K, solution=sol, output=plot);
 
q11:=ln(Eh1/Ek1)/ln(h/k);
q12:=ln(Ek1/EK1)/ln(k/K);
 
Eh2:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=h, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=h, solution=sol, output=plot);
Ek2:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=k, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=k, solution=sol, output=plot);
EK2:=ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=K, solution=sol, output=totalerror);
ODENumeric(ODE, yinit=[1], x=0..1, method=[taylor,4], stepsize=K, solution=sol, output=plot);
 
q21 := ln(Eh2/Ek2)/ln(h/k);
q22 := ln(Ek2/EK2)/ln(k/K);

 

HDČR © říjen 2009

Vytvořte si web zdarma!Webnode