Mathematica Tool 3

This Mathematica notebook is designed for use with Exercise 19 in Section 5.3

Enter your formula for the derivative, yprime. Your formula should involve both x and y.

yprime[x_,y_]:="???"

The following steps carry out the iteration and plot the numerical solution.

(Subscript[y, 0])=0;
n=10;

Δ=(1/n);
Y=Range[n];
x=(Range[n]-1) Δ;
Y[[1]]=(Subscript[y, 0]);
For[i=2,i<n+1,i++,Y[[i]]=N[Y[[i-1]]+Δ yprime[x[[i-1]],Y[[i-1]]]]]
Solution=Partition[Riffle[x,Y],2];
solPlot=ListPlot[Solution,PlotStyle->{Blue,PointSize[0.02]}]

Compare the left and right sides of the defining equation at x=1:

Sin[1.0] Cos[Y[[n]]]
Y[[n]]