Решете моделната задача
u’(x)=10u(1-u), 0<x<=6,
u(0)=0.1
при n=10, 20, 35, 75, 200 и сравнете с точното решение.

Явен метод на Ойлер

explicitEulerMP[n_]:= (
h=6/n;
y=Table[0,{n+1}];

y[[1]] = 0.1;
For[i=1, i<n+1, i++,
y[[i+1]] = y[[i]]+10.*h*y[[i]](1-y[[i]])
];

y
)

Неявен метод на Ойлер

implicitEulerMP[n_]:= (
h=6/n;
y=Table[0,{n+1}];

y[[1]] = 0.1;
For[i=1, i<n+1, i++,
initialGuess =y[[i]]+10.*h*y[[i]](1-y[[i]]);
y[[i+1]]=yNew/.FindRoot[yNew==  y[[i]]+10.*h*yNew(1-yNew),{yNew,initialGuess}]
];

y
)

Функция за визуализация

exact[x_]=DSolve[{u'[x]==10u[x](1-u[x]),u[0]==0.1},u[x],x][[1, 1, 2]];
plotExact = Plot[exact[x],{x,0, 6}, PlotStyle->Red, PlotRange->All];

plot[n_, method_]:=(
times=Table[i*6/n,{i,0,n}];
appr =method[n];
plotAppr = ListLinePlot[Transpose[{times,appr }], PlotMarkers->●, PlotRange->All];
Show[plotExact, plotAppr]
)

n1={10,20,35,75,500};
GraphicsRow[Table[plot[n,explicitEulerMP],{n, n1}]]

n1={10,20,35,75,500};
GraphicsRow[Table[plot[n,implicitEulerMP],{n, n1}]]