Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Differen-
-2
-1
-0.5
-1.0
-1.5
-2.0
clear@modiefiedeulerD
clear@modiefiedeulerD
modifiedeuler@f_, 8x_, x0_, xn_<, 8y_, y0_<, steps_D :=
Block@8xold = x0, yold = y0, sollist = 88x0, y0<<, x, y, h<, h = N@Hxn - x0L stepsD;
Do@xnew = xold + h;
fold = f . 8x xold, y yold<;
ynew = yold + Hh 2L * HHfoldL + f . 8x xold + h, y yold + h * fold<L;
sollist = Append@sollist, 8xnew, ynew<D;
xold = xnew;
yold = ynew, 8steps<D;
Return@sollistDD
Assignment 8.nb
98- 2, - 2<, 8- 1.8, - 1.04<, 8- 1.6, - 0.537726<, 8- 1.4, - 0.253993<, 8- 1.2, - 0.1073<,
8- 1., - 0.0621201<, 8- 0.8, - 0.0973579<, 8- 0.6, - 0.193606<, 8- 0.4, - 0.327991<,
8- 0.2, - 0.47472<, 9- 2.77556 10-16, - 0.60954=, 80.2, - 0.714329<, 80.4, - 0.778617<,
In[77]:=
plt@3D = ListPlot@%7,
PlotStyle Directive@RGBColor@0., 0.95, 0.09D, AbsoluteThickness@2.D, DashedD,
Joined TrueD
0.5
-2
Out[77]=
-1
-0.5
-1.0
-1.5
-2.0
98- 2, - 2<, 8- 1.8, - 0.6<, 8- 1.6, - 0.08<, 8- 1.4, 0.23328<, 8- 1.2, 0.436164<,
8- 1., 0.562212<, 8- 0.8, 0.625428<, 8- 0.6, 0.63166<, 8- 0.4, 0.583459<,
8- 0.2, 0.483544<, 9- 2.77556 10-16, 0.338307=, 80.2, 0.161197<, 80.4, - 0.0256058<,
80.6, - 0.193475<, 80.8, - 0.313988<, 81., - 0.36627<, 81.2, - 0.33944<,
81.4, - 0.228396<, 81.6, - 0.0259629<, 81.8, 0.286172<, 82., 0.750551<=
Assignment 8.nb
-2
-1
-0.5
-1.0
-1.5
-2.0
In[78]:=
0.5
-2
Out[78]=
-1
-0.5
-1.0
-1.5
-2.0
From these three graphs it is evident that the modified eulers method is perfect match to the
analytical solution obtained from Mathematica but there is significant error if soultion is obtained
from Eulers method.