Direction Fields; Euler s Method It frequently happens that we cannot solve first order systems dy (, ) dx = f xy or corresponding initial value problems in terms of formulas. Remarkably, however, this problem can be visualized in such a way that the rough behavior of the solutions can be determined by inspection. It is also true that this method leads to a useful way to determine solutions to initial value problems numerically.
If y(x) is a solution the DE Direction fields dy (, ) dx = f xy then, even if we do not have a formula for y(x) or knowledge of its overall behavior, we do know that when its graph goes through the point (x, y), the slope of the tangent line to the graph at that point will be the number f(x, y). This is because the slope of the tangent line is the derivative. Thus we decide to choose a grid of points in the plane, and at each point draw a small line segment whose slope is f(x, y).
If an initial condition is specified, such as the red point shown below, then the solution that goes through that point can be easily visualized, at least approximately. Initial point (x 0, y 0 )
If an initial condition is specified, such as the red point shown below, then the solution that goes through that point can be easily visualized, at least approximately.
In this way we can often determine if a solution is bounded or becomes infinite, and what its general shape is. One way to plot direction fields easily is to look at the curves f( xy, ) where c is a constant. Plot this curve for some fixed value of c, then observe that the slope f(x, y) is the same at every point of the curve. Compute the direction field line segment at one such point, and simply carry it to the other points in a parallel fashion. = c
Example. Plot the direction field corresponding to the DE dy y dx = Solution. The direction field has the same slope c at every point on the curve y = c. These curves are horizontal straight lines. Thus on the line y = 0 (the x-axis) the slopes are all 0, on the line y = 1, the slopes are all 1, on y = 2, they are all 2, and so on.
y = 1 y = 1/2 y = 0 y = 1
The integral curves that correspond to the initial conditions y(0) = 0 (green), y(0) = 1 (red), and y(0) = 1, (blue) are shown below.
Let us compare these results to the actual solutions of the equation dy y dx = corresponding to those three initial conditions. Here we can separate the equation to get Thus ln y = x + C, or dy dx y = y= Cex 1. The three initial conditions y(0) = 0, y(0) = 1, and y(0) = 1 give us the corresponding three solutions y= 0 y= ex y= ex
We compare below the graphs of the actual solutions with the approximate solutions derived from the direction field.
Below is the direction field for the DE y = x2+ y2. It is easily plotted by hand if we note that the curve x 2 + y 2 = c 2 is a circle of radius c and center (0, 0). Everywhere on such a circle, the slope of the line segments is c 2.
Finally, we add the solution if the initial condition is y(0) = 1.
Note that the previous DE y = x2+ y2 is neither separable nor linear, so we do not have any way to solve it at this point. Euler s Method for Computing Approximate Solutions to Initial Value Problems. Using the idea of direction fields, as demonstrated above, we can begin with a differential equation and an initial value point in the plane, and try to approximate the solution at a succession of points spaced h units apart, where h is small. These approximations will be gradually deviate from the true solution, but will be close if h is small, and we do not try to take too many steps.
Slope = f(x 1, y 1 ) Slope = f(x 0, y 0 ) h x 0 x 1 = x 0 +h x 2 = x 1 +h Begin at (x 0, y 0 ). The solution must move in the direction of a line of slope m = f(x 0, y 0 ). Move along that line to a new point (x 1, y 1 ), where x 1 = x 0 +h, and y 1 = y 0 +f(x 0, y 0 )h. At that point we move in the direction of a line with slope m = f(x 1, y 1 ) to a new point (x 2, y 2 ), where x 2 = x 1 +h, and y 2 = y 1 +f(x 1, y 1 )h.
Slope = f(x 2, y 2 ) Slope = f(x 1, y 1 ) Slope = f(x 3, y 3 ) Slope = f(x 0, y 0 ) h x 0 x 1 = x 0 +h x 2 = x 1 +h x 3 = x 2 +h Thus we generate a sequence of x locations x 1 = x 0 +h, x 2 = x 1 +h, x 3 = x 2 +h, x 4 = x 3 +h, And a sequence of corresponding y locations y 1 = y 0 +f(x 0, y 0 )h, y 2 = y 1 +f(x 1, y 1 )h, y 3 = y 2 +f(x 2, y 2 )h,
Here is a table of Euler s method for the initial value problem y = y xy ; (0) = 2; h= 0.1 n x n y n f(x n, y n )h y n+1 0 0 2.00000 0.20000 2.20000 1 0.1 2.20000 0.21000 2.41000 2 0.2 2.41000 0.22100 2.63100 3 0.3 2.63100 0.23310 2.86410 4 0.4 2.86410 0.24641 3.11051 5 0.5 3.11051 0.26105 3.27156 6 0.6 3.37156 0.27716 3.64872 7 0.7 3.64872 0.29487 3.94359 8 0.8 3.94359 0.31436 4.25795 9 0.9 4.25795 0.33579 4.59374
Here is a table indicating the error that occurs. x Exact Solution Euler Approx. Error Percent Error 0 2.00000 2.00000 0.00000 0.00 0.1 2.20517 2.20000 0.00517 0.23 0.2 2.42140 2.41000 0.01140 0.47 0.3 2.64986 2.63100 0.01886 0.71 0.4 2.89182 2.86410 0.02772 0.96 0.5 3.14872 3.11051 0.03821 1.21 0.6 3.42212 3.37156 0.05056 1.48 0.7 3.71375 3.64872 0.06503 1.75 0.8 4.02554 3.94359 0.08195 2.04 0.9 4.35960 4.25795 0.10165 2.33