impeulersteps:=proc(f,x0,y0,h,N) local Z,xold,yold,xnew,ynew,k1,k2,u,n: Z:=[[x0,y0]]: for n from 2 to N+1 do xold:=Z[n-1][1]: yold:=Z[n-1][2]: xnew:=xold+h: k1:=f(xold,yold): u:=yold+h*k1: k2:=f(xnew,u): ynew:=yold+h*.5*(k1+k2): Z:=[op(Z),[xnew,ynew]]: end do: Z: end: #f:=proc(x,y) y: end: #p:=plot(eulersteps(f,0,1,.1,10),color=blue); #Q:=dsolve({diff(y(x),x)=y(x),y(0)=1},type=numeric,range=0..1); #q:=odeplot(Q); #plotsetup(x11); #with(plots); #display(p,q);