Introduction: Spreadsheet Calculus: Euler's Method
If you've tried solving any differential equations, you probably know that many of them are either very difficult or impossible to solve. What do we do then? Usually the solution to a differential equation actually isn't that important. The question you usually want answered is what happens when I start at certain coordinates? What does the differential equation do?
If you have a spreadsheet program, then answering these questions is pretty easy. You don't need to solve the equation to find out what it does.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Find a Differential Equation
First you need a differential equation that you want (or need) to solve. For my first example I'm going to use a simple equation that's easy to solve. dy/dx=ry. The solution is y=Aerx, where A is an arbitrary constant.
Type in a dx value and make a graph of the solution, it should look something like the second picture. For most differential equations, you wont know the solution, the only reason we're putting it in first here is to confirm that this method works.
Step 2: Use Euler's Method
Here's how Euler's method works. Basically, you start somewhere on your plot. You know what dy/dx or the slope is there (that's what the differential equation tells you.) So you make a small line with the slope given by the equation. Then at the end of that tiny line we repeat the process. Soon enough we've sketched a solution curve to the differential equation. As long as we choose small enough step sizes, the solution curve found this way follows the true solution curve almost perfectly.
Here's how you do it: first set an initial state. In this case I'm going to choose 2, since it's the initial value of the solution curve I sketched earlier. Then, below your initial value you want to type in your differential equation (as a function of the initial value) be sure to multiply it by your dx value. Your differential equation has the form dy/dx. If you multiply it by the step size (dx) then you're left with dy, the change in y, which is added to the previous y value. The picture below explains this a lot better than I ever could.
Step 3: Graph It
Plot it and check that it works. Notice in the picture below that the solution using Euler's method follows the solution found by solving the equation almost perfectly. The demo file is attached in case you need help for this.
Step 4: Do a Tough One
Now let's try it with a differential equation that can't be solved using traditional methods. The differential equation shown below is completely made up and doesn't model anything as far as I know. I don't know how to solve it, but I can still visualize solutions to it by using Euler's method. The second picture are solution sketches with different starting conditions. The excel file is also attached if you need help.
Using this method, sketching solutions to differential equations becomes quite easy. Just make sure you use small enough step sizes to reduce the error rate. If you have big step sizes, your solution will be very inaccurate. You want your columns to be at least 100 cells long.