I want to be able to plot several numerical solutions of an ODE, plus its analytical solution in one plot, in order to see how the numerical solutions converge towards the analytical one with respect to the number of steps. The method I'm using is Euler's method for the equation $ y'(t) = 1-t +4y(t), y(0)=1$
The code I have so far is:
y[0]=1;
Do[y[n+1]=y[n]+0.01(1-0.01n+4y[n]), {n,0,99}]
y[100]
Is this doable? Thanks in advance for any help :)
Plot
andListPlot
will accept lists of functions/lists to plot. $\endgroup$ – image_doctor Nov 12 '12 at 16:23Show
to combine plots $\endgroup$ – ssch Nov 12 '12 at 16:38