/*********************************************** ************************************************ ************************************************ Euler.mac This software is a part of: Kai Velten: Mathematical Modeling and Simulation, Wiley-VCH, 2009. It can be used under the conditions of the GNU General Public License (GPLv3), see http://www.gnu.org/licenses/gpl.html. ************************************************ ************************************************ ************************************************/ /* Initializations */ h:0.25; n:4/h; y[0]:1; for i:1 thru n step 1 do y[i]:(1+h)*y[i-1]; EulerApprox1:create_list([i*h,y[i]],i,0,n); h:1; n:4/h; y[0]:1; for i:1 thru n step 1 do y[i]:(1+h)*y[i-1]; EulerApprox2:create_list([i*h,y[i]],i,0,n); /* Plot the result: */ plot2d( [ [discrete,EulerApprox1] ,[discrete,EulerApprox2] ,exp(t) ] ,[t,0,4] ,[style , [points,5,1,10] , [points,9,1,1] ,[lines,5,1]] ,[xlabel,"x"] ,[ylabel,"y"] ,[legend, false] )$