![]() |
|||
Mathematics & Science
Learning Center |
|||
Numerical Methods for Solving Differential EquationsEuler's Method(continued from last page...) Using the Method with MathematicaUp to this point in the laboratories we have been using Mathematica purely as a computer algebra system. We have been giving it commands one at a time, hitting [ENTER], and waiting for the result. However, the true power of the Mathematica system cannot be fully tapped until you learn that it is possible to put strings of commands together in a single cell. In other words, you can write programs in Mathematica. An Unrelated Example of a ProgramJust to get the basic idea, let's look at a mini-program that has nothing whatsoever to do with Euler's Method. Consider the following sequence of instructions:
Print["Hello!"]; Notice that we have four lines of code here, and that each one is separated from the next by a semi-colon. (In actuality these instructions need not even be on separate lines provided that they have a semi-colon separating them.) Let's talk about the action of each line individually:
Now that we know what the program is supposed to do, let's go the Mathematica and type it in to see if it works. Remember, you can use Copy and Paste if you want to save yourself the effort of typing. Now let's go see what you should have gotten... |
|||
ODE Laboratories: A Sabbatical Project by Christopher A. Barker ©2009 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA e-mail: cbarker@deltacollege.edu |
|||