2、+x-y[x],y[0]==0},y[x],x]求得:y=b—屮港+e^X2)2•向前欧拉法x[0]=0;y[0]=0;h=0.1;f[x_]:=e"x(—1+L-exx+;x[n_]:=n*h;f【u_,v」:=『+u・v;Kl[n_]:=f[x[n-l],y[n-l]];y[n_]:=y[n-l]+h*Kl[n];Table[{n,x[n],y[n],f[x[n]],f[x[n]]-y[n]}4nA10}]//N;Print[,'n,x[n],y[n],f[x[n]],f[x[n]]-y[n],,'",M
3、atrixForm
4、Table[{n,x[n],y[n],f[x[n]],f[x[n
5、]-y[n]},{n,0,10}]//N]]Data1=Table[{x[n],f[x[n]]},{n,0,10}]//N;Data2=Table[{x[n],y[n]},{n,O,l0}]//N;A()=Plot[f[x],{x,0,1},PlotStyleT{Red,Thick}];A1=Graphics[{PointSize[0.02],Red,Point[Data1]}];A2=ListLinePlot[Data2,PlotS
6、tyle^{Red,Dashed}];A3=Graphics[{PointSize[0.02],Blue,Point[Data2]}];Show[A0,Al,A2,A3,PlotRange^All]nrx[n]Fy[n]rf[x[n]]rf[x[n]]-y[n]0・0.0・0.o.••1.0.10・0.005162580.005162582.0.20.0110.02126920.01026923・0.30.03390.04918180.01528184.0.40.069510.089680.020175.0.50.11
7、85590.1434690.02491036.Q.60.1817030.2111880.02948537・0・70.2595330.2934150.03388198e0<80.352580.3906710.03809159・0・90.4613220.503430.042108810.1.0.5861890.6321210.04593123.改进欧拉法f[x_zy_]:=x2+x-y;f[x_]:=e"x(-l+h-e3rx+e^x2);xy:={{Ozl}};h=0・1;Do[xn=xy[[n]][[1]];yn=xy
8、[[n]][[2]];kl=f[xn,yn];k2=f[xn+hzyn+h*kl];d=(kl+k2)*h/2;Print[n,n11,"x11J1二",xn+hz1111,nyn,n,11=11#yn+d#"nzHf(x»,11,n)=nzf[xn+h]znn,11f(x11,n,n)-y(xnznf11)=n,f[xn+h]-(yn+d)];xy=Append[xy,{xn+h,yn+d}]r{n,1,10}];Al=Graphics[{Pointsize[0・02]zRed,Point[xy]}];A2=List
9、LinePlot[xy,Plotstyle—>Dashed];A3=Plot[f[x]z{xf0z1},PlotStyle—>{Red,Thick}];Show[A3,h2,hl]x2=0.2y2=0.840953fi:x2)=0.0212692f(x2)-y(x2)=-0.819683x3=0•3y3=0<791362f(x3j=0.0491818ffx3j-yi:x3j=-0.74218x4=0.4y4=0.761733f(x4)=0.08968f(x4)-y(x4)=-0.672053x5=0.5丫5=0.752
10、0“f(x5)=0.1434691f(x5)-y(x5)=-0>608599x6=0.6y6=0.762372f(x6:!=0.211188f(x6)-y(x6)=-0.551183x7=0.7y7=0<792646f(x7)=0.293415f(x7:!-yi:x7)=-0-499232x8=0.8y8=0.842895f(x8