| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, and Slack. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.

View
 

Numerical-solution-of-differential-equations-using-Euler's-method

Page history last edited by Alex Schneider 13 years, 11 months ago

Euler's Method

 

 

Leonhard Euler (this is HIS method) 

 

Definition: Euler's Method is a means of approximating a certain point on a curve, given only the derivative. It's a pretty great technique to know, as it allows you to extrapolate data from an experiment or approximate a solution curve for an undefined function, without going through excessive mathematical trauma. Also, it's really cool. And fun.

 

 

Instructions:

To use Euler's Method, you must be given a few minimal pieces of information: the equation of the derivative itself, the "step size" (which is the same as dx), and an initial point and a target point.

I'll demonstrate the process with the equation dy/dx=1+3x-2y, with a step size of 0.5, a starting point of (1, 2), and target of x=3.

First, you will have to set up a table with four columns, labelled "dy," "dx," "x," and "y."

dy dx x y
       
       

Let's add all of the information we know to our table. dx means the change in x, which is step size, so we'll fill in 0.5 for the entire dx column. We also know the initial point, so we'll add those x and y values in their respective columns.

dy dx x y
  0.5 1 2
  0.5    
  0.5    

Now, since dx is the change in x, we can fill in the rest of the x column, adding 0.5 each time (so the second term will be 1.5, the third 2.0, and so on). We know that the target point is at x=3, so we'll continue filling out the table until we get to that point.

dy dx x y
  0.5 1 2
  0.5 1.5  
  0.5 2.0  
  0.5 2.5  
  0.5 3.0  

To progress from this point, we must complete the first row of boxes - so we must find dy. The equation is a given, and, when solved for dy, is dy=(1+3x-2y)dx. From here, it is a simple matter to plug in all of the numbers. The resulting equation looks like this: dy=(1+3(1)-2(2))(0.5). When solved, this equation equals 0. Since dy is the change in y, just as dx is the change in x, we can find the second y value by adding the first y to the first dy. Thus, since 2 plus 0 equals 2, the second y value is also 2.

dy dx x y
0 0.5 1 2
  0.5 1.5 2
  0.5 2.0  
  0.5 2.5  
  0.5 2.5  

Now we continue with this process. Using the dx, x, and y from the second row, we use the original equation to determine the second dy value; this value turns out to be 0.75. Following our procedure, we add that dy to the y value from the same row, and get 2.75 for the third y value. Again, we solve for dy, using the values from third row; dy turns out to be 0.75 again, and thus the y value in the fourth row is 3.5. One final time, we plug our values into the original equation, and get 0.75 yet again for our dy; adding that to our y value of 3.5, we get 4.25 for our fifth and final row. At this point, the table should look like this:

dy dx x y
0 0.5 1 2
0.75 0.5 1.5 2
0.75 0.5 2.0 2.75
0.75 0.5 2.5 3.5
  0.5 3.0 4.25

We have now successfully used Euler's method: we have found that, at x=3 of the solution to the differential equation dy/dx=1+3x-2y, the point is (3, 4.25). Great job!

 

 

Drawing the solution curve to a differential equation using Euler's Method:

Creating a solution curve, given a differential equation, is a very simple process when one uses Euler's Method. Essentially, each of the (x, y) pairs found in our table is a point on the curve. So, using our example above, the solution curve for the equation dy/dx=1+3x-2y would pass through the points (1, 2), (1.5, 2), (2.0, 2.75), (2.5, 3.5), and (3.0, 4.25). You would get a curve that looks something like this (where the blue line is the actual solution curve to the differential equation, and the pink line is the approximation created using Euler's Method):

Now, it's a good thing to keep in mind that, since dx is the step size - the distance between each point on your graph - the smaller dx is, the more accurate your solution curve will be. For example, here is a graph of a solution curve to the same equation we used earlier, but with a step size of 0.3 - it is easy to see that the pink line is a much closer approximation to the solution curve:

This process only approximates the solution curve of a given differential equation, but, with a small enough dx, can become fairly accurate. You might want to try playing around with the two links below, as that may help you with your understanding of this process. (Both of the graphs in this section were created using the applet from the second link.)

 

Links: The following links will provide you with a visual demonstration of Euler's Method.

http://www.csun.edu/~hcmth018/EuM.html

http://www.calculusapplets.com/euler.html

 

Sample Problems:

1) Consider the following equation dy/dx=y-2x+3, where y=f(x) is the solution to the equation and f(2)=5. Using Euler's method starting at x=2 with step size dx=0.5, what is the approximation for f(3)?

          (a) 7

          (b) 8.5

          (c) 9

          (d) 9.5

          (e) 11

2) Consider the equation dy/dx=(y+1)/x. Given the point (1, 0) and a step size of dx=0.5, and using Euler's Method, what is an approximation for f(3)?

          (a) 2

          (b) 3

          (c) 4

          (d) 5

          (e) 6

3) Given the differential equation dy/dx=(x+7)/(2y), the initial point (0, 3), and the step size dx=0.25, what is a valid approximation for f(1)?

          (a) 3.917

          (b) 4.083

          (c) 4.102

          (d) 4.226

          (e) 4.298

4) Let f be a function such that f'(x)=(2x+sinx)/(x2+1) and f(2)=-1. Use Euler's Method with 3 equal steps to approximate f(2.3). 

5) Let dy/dx=3/x. Use Euler's Method to approximate the y values for four steps, starting at the point (1, 0) and letting dx=0.5.

6) Given the differential equation dy/dx=(x-2y)/x, and the fact that f(2)=1, use Euler's Method to estimate f(3), using a step size of dx=0.25.

 

 

 

Answers:

1) (d)

2) (a)

3) (b)

4) Approximately -0.719

5)

x y
1 0
1.5 1.5
2.0 2.5
2.5 3.25
3.0 3.85

6) Approximately 1.127

 

Question 1 borrowed from "Fast Track to a 5: Preparing for the AP Calculus AB and Calculus BC Examinations," by Sharon Cade, Rhea Caldwell, and Jeff Lucia. Questions 2 and 3 created by Alex Schneider. Question 4 borrowed from "Preparing for the AP Calculus (BC) Examination," by George W. Best and J. Richard Lux. Questin 5 adapted from "How to Prepare for the AP Calculus Exam," by Shirley O. Hockett and David Bock. Question 6 borrowed from Calculus-Help.com, which in turn borrowed from the 2002 BC Calculus AP Exam. The image at the top of the page, of Mr. Euler, is borrowed from the Wikipedia page on Leonhard Euler (http://en.wikipedia.org/wiki/Euler). 

Comments (1)

jdebruin@... said

at 9:31 pm on Feb 2, 2009

Very nice Mr. Schneider. I liked the sequence of graphs in the way it went step by step. The links with the visual demonstrations were also nice. I might have liked some different fonts/headings to spice up the page. Otherwise very straightforward.

You don't have permission to comment on this page.