Euler Method - Using the Method with Mathematica - Part 7
Numerical Methods for Solving Differential Equations
Euler's Method
Using the Method withÌýMathematica
(continued fromÌýlast page...)
Instructions for the Exercises
Once again it's time to have you attempt to do some work on your own. The examples that we've already done together should have sufficiently prepared you to tackle these problems. As you work through them, don't cheat yourself by first skipping forward and looking at the solutions. After all, you are supposed to be doing these exercises to enhance your learning, and to prepare yourself for the laboratory exam that you'll take later.
Some of these exercises may be solvedÌýexactlyÌýusing the techniques that you have already learned in the lecture component of this course. If you're feeling ambitious, you might attempt to find the exact solutions to the exercises, where this is possible, and then use these solutions to help you gauge how good the corresponding numerical solutions are, just as we did back in theÌýIntroduction.
Use theÌýeulerÌýprogram:
euler[f_,{x_,x0_,xn_},{y_,y0_},steps_]:=
Block[{ xold=x0,
ÌýÌýÌýÌý²â´Ç±ô»å=²â0,
ÌýÌýÌýÌý²õ´Ç±ô±ô¾±²õ³Ù=µ÷µ÷³æ0,²â0°¨°¨,
ÌýÌýÌýÌý³æ,²â,³ó
ÌýÌý°¨,
ÌýÌý³ó=±·°Ú(³æ²Ô-³æ0)/²õ³Ù±ð±è²õ±Õ;
ÌýÌýDo[ xnew=xold+h;
ÌýÌýÌýÌý²â²Ô±ð·É=²â´Ç±ô»å+³ó*(´Ú/.µ÷³æ-&²µ³Ù;³æ´Ç±ô»å,²â-&²µ³Ù;²â´Ç±ô»å°¨);
ÌýÌýÌýÌý²õ´Ç±ô±ô¾±²õ³Ù=´¡±è±è±ð²Ô»å°Ú²õ´Ç±ô±ô¾±²õ³Ù,µ÷³æ²Ô±ð·É,²â²Ô±ð·É°¨±Õ;
ÌýÌýÌýÌý³æ´Ç±ô»å=³æ²Ô±ð·É;
ÌýÌýÌýÌý²â´Ç±ô»å=²â²Ô±ð·É,
ÌýÌýÌýÌý²õ³Ù±ð±è²õ
ÌýÌý±Õ;
ÌýÌý¸é±ð³Ù³Ü°ù²Ô°Ú²õ´Ç±ô±ô¾±²õ³Ù±Õ
]
that you entered intoÌýMathematicaÌýearlier, to solve each of the initial value problems given in the table below. For each exercise, do the following:
Find the numerical solution, in the form of a list, on theÌýx-interval spanning from the initial condition point up to the specifiedÌýx-value.
Read this solution list into the solution name specified for the exercise.
Use the number of steps specified.
Redisplay your solution in tidy columns with a command of the formÌýMatrixForm[Solution Name], inserting the appropriate name for the exercise inside the brackets.
Plot your solution using a command of the formÌýListPlot[Solution Name], inserting the appropriate name for the exercise inside the brackets.
Check your solution and its graph by clicking on theÌýMathematicaÌýAnswer button provided.Ìý(Only do this once you've tried the problem yourself.)
Exercises
If you've finished the above exercises, then you may eitherÌýreturn to the beginningÌýof this laboratory, jump to theÌýTable of ContentsÌýof all of the differential equations laboratories, or simply quit.
Ìý








