Professional Documents
Culture Documents
Lab 4 PDF
Lab 4 PDF
módulo
{n, Y, Yp, u, YMathematica, puntos},
n = FloorX h;
entero inferior
Y[0] := y0;
Yp[0] := y1;
1 1 h 1
Y[n_] := Y[n] = NY[n - 1] + h Yp[n - 1] + 2 h h f + h n - 1, Y[n - 1] + h Yp[n - 1],
valor numérico 6 2 2 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] + Yp[n - 1] +
2
h 1 1
h h f + h n - 1, Y[n - 1] + h h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] ,
2 2 2
1 h 1
h f + h n - 1, Y[n - 1] + h Yp[n - 1],
2 2 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] + Yp[n - 1] + Yp[n - 1] +
2
1
2h h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] ;
2
1 h 1
Yp[n_] := Yp[n] = N 2 h f + h n - 1, Y[n - 1] + h Yp[n - 1],
6 numérico2
valor 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] +
2
h 1 1
2 h f + h n - 1, Y[n - 1] + h h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] ,
2 2 2
1 h 1
h f + h n - 1, Y[n - 1] + h Yp[n - 1],
2 2 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] + Yp[n - 1] +
2
1 h 1
h fh + h n - 1, Y[n - 1] + h h f + h n - 1, Y[n - 1] + h Yp[n - 1],
2 2 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] + Yp[n - 1] ,
2
h 1 1
h f + h n - 1, Y[n - 1] + h
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] ,
2 2 2
1 h 1
h f + h n - 1, Y[n - 1] + h Yp[n - 1],
2 2 2
1
h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1] + Yp[n - 1] +
2
Yp[n - 1] + h fh n - 1, Y[n - 1], Yp[n - 1] + Yp[n - 1];
puntos = ArrayRGBColor[1, 1, 0], PointSize1 70, Point# - 1 h, Y[# - 1] &, n;
arreglo color RGB tamaño de punto punto
YMathematica[x_] := NDSolve[u ''[t] ⩵ F[t, u[t], u '[t]] && u[0] ⩵ y0 && u '[0] ⩵ y1,
resolvedor diferencial numérico
u[t], {t, 0, X}][[1, 1, 2]] //. t → x;
;
2 lab4.nb
In[101]:= DSolvey ''[x] + 2 y '[x] + 3 y[x] ⩵ sin[x] && y[0] ⩵ 1 && y '[0] ⩵ 1 5, y[x], x // FullSimplify
resolvedor diferencial simplifica completamente
1
In[102]:= g1 = Plot ⅇ-x 15 Cos 2 x + 5 ⅇx Cos[x] + Sin[x] + 7 2 Sin 2 x,
20
representación grá⋯ coseno coseno seno seno
1.0
0.8
0.6
0.4
Out[102]=
0.2
2 4 6 8 10
-0.2
-0.4
lab4.nb 3
In[111]:=
1.0
0.8
0.6
0.4
Out[114]=
0.2
2 4 6 8 10
-0.2
-0.4
In[115]:=
Show[g1, g2]
muestra
1.0
0.8
0.6
0.4
Out[115]=
0.2
2 4 6 8 10
-0.2
-0.4