euler modificado vs heun a

3
usando el metodo de Euler Modificado y Heun y comparandolos Ejercicio b y’=Sent + ª -t ,0 £ t £ 1, yH0L = 0 con h = 1 2 (Debug) In[209]:= DSolveB:y'@tD y@tD t 2 + y@tD t ,y@1D 1>,y@tD,tF Simplify DSolveBy'@tD 1 t IHy@tDL 2 + y@tDM,y@tD,tF Simplify; (Debug) Out[209]= ::y@tD fi- t - 1 + Log@tD >>

Upload: david-justiniano-quispe-apaza

Post on 19-Jan-2016

19 views

Category:

Documents


6 download

TRANSCRIPT

� usando el metodo de Euler Modificado y Heun y comparandolos

Ejercicio b y’=Sent + ã-t , 0 £ t £ 1 , yH0L = 0 con h =1

2

(Debug) In[209]:=

DSolveB:y'@tD �y@tD

t

2

+y@tD

t, y@1D � 1>, y@tD, tF �� Simplify

DSolveBy'@tD �1

tIHy@tDL2

+ y@tDM, y@tD, tF �� Simplify;

(Debug) Out[209]=

::y@tD ® -t

-1 + Log@tD>>

(Debug) In[291]:=

H*usando el metodo de Euler Modificado y Heun y comparandolos

Ejercicio b y'=I y

tM2

+I y

tM , 1£t£2 , yH1L=1 con h=0.1*L

f@t_, y_D := Ky

tO

2

+ Ky

tO

y1@t_D := -t

-1 + Log@tDy1 = 1;

a = 1;

b = 2;

n = 5;

q = SetPrecision;

s = 6;

t0 = 1;

h = 0.1;

we0 = y1;

wh0 = y1;

ForBi = 1, i £ n,

wei = wei-1 +h

2Hf@ti-1, wi-1D + f@ti-1, wei-1 + h * f@ti-1, wei-1DDL;

whi = whi-1 +h

4f@ti-1, wi-1D + 3 * fBti-1 +

2

3h, wi-1 +

2

3h * f@ti-1, wi-1DF ;

yi = y1@ti-1D;

ti = a + i * h;

i++F

TableForm@Table@8q@yi+1, sD, q@wei, sD,

q@Abs@yi+1 - weiD, sD, q@whi, sD, q@Abs@yi+1 - whiD, sD<, 8i, 0, n - 1<D,

TableHeadings ® 8Automatic, 8"Valor real", "Euler Mod.", "Error-Euler Mod"

, "Heun", "Error Heun"<<D

Plot@y1@tD, 8t, a, b<, PlotStyle ® 8Black, Thick<, Epilog ® 88Black, [email protected], Point@Table@8tm, y1@tmD<, 8m, 0, n<DD<,

8Green, [email protected], Point@Table@8tm, wem<, 8m, 0, n<DD<,

8Blue, Line@Table@8tm, y1@tmD<, 8m, 0, n<DD<,

8Red, Line@Table@8tm, wem<, 8m, 0, n<DD<<

DPlot@y1@tD, 8t, a, b<, PlotStyle ® 8Black, Thick<, Epilog ® 8

8Black, [email protected], Point@Table@8tm, y1@tmD<, 8m, 0, n<DD<,

8Green, [email protected], Point@Table@8tm, whm<, 8m, 0, n<DD<,

8Blue, Line@Table@8tm, y1@tmD<, 8m, 0, n<DD<,

8Red, Line@Table@8tm, whm<, 8m, 0, n<DD<<

D

2 Euler MOdificado.nb

(Debug) Out[304]//TableForm=

Valor real Euler Mod. Error-Euler Mod Heun Error Heun1 1.00000 1.00000 0 1.00000 02 1.21589 1.13200 0.0838863 1.00000 0.2158863 1.46757 1.27220 0.195368 1.00998 0.4575934 1.76239 1.42125 0.341138 1.02970 0.7326855 2.10993 1.57969 0.530244 1.05883 1.05110

(Debug) Out[305]=

1.2 1.4 1.6 1.8 2.0

2

3

4

5

6

(Debug) Out[306]=

1.2 1.4 1.6 1.8 2.0

2

3

4

5

6

Euler MOdificado.nb 3