Euler's Method is an algorithm used to construct approximate solutions to a differential equation of the form starting at an initial point .
Since the differential equation tells us the slope of the tangent line at any point on the xy-plane, we can find the slope at and move along the tangent line some distance to a point . Since the solution curve is close to its tangent line (as long as we're not too far from the point of tangency), the point is almost on the solution curve.
Now we repeat the process. Find the tangent line at using the differential equation, follow it for a short distance, and find a new point . This point is also close to the solution curve.
Repeat the process as many times as you like.
The process is the same each time, so we can develop an iterated formula and automate the process.
Let's determine how to get from to .
First, we need to find the tangent line at .
In general, the tangent line to a function at the point has equation .
In this case, the derivative is given by the differential equation, , and , so we have .
We will move along the tangent line the same horizontal distance each step of the process. In other words, is a constant, called the “step size.” We will call this .
In summary, we have the following:
Use Euler's Method to approximate the solution curve to the differential equation that passes through the point . Plot the approximation for .
We'll start with a small example by hand, and then we'll let the computer do the work.
We will use just 5 steps. That means the step size is .
We'll start with and , and then we will calculate new x- and y-coordinates with the formulas
Now let's plot these six points.
The six points above are approximately on the solution curve. If we connect the points with straight lines, we will have an approximate solution curve.
Of course, just 5 steps is not enough to get a good approximation, so we'll use the computer with many more steps.
Here is a plot of our approximation (blue) along with the actual solution (red).
We can make the approximation better by increasing (this decreases the step size).
If we want to plot the approximation past , then we can change x_end. Of course, the approximation is going to get worse when we are farther away from our starting point.
The interactive box below allows us to change and x_end. Experiment with different values.
Consider the initial value problem .
Use Euler's Method to approximate .
I will copy and paste the formulas from above, skipping the plot:
We have found that .
Let's try a higher value of n and see what happens.
Now we have .
Let's find the actual value. First, solve the differential equation.
Now plug in .
Notice that increasing has gotten us closer to the actual answer. Let's increase one more time and see if we can get at least the first decimal place correct.
Here is a summary of our results:
The actual value is .