We haven’t yet studied any general ways to solve differential equations. In the first case of exponential growth we found an easy way to solve the equation, but for the logistic equation we just gave the solution and showed that it indeed satisfied the equation. Here we are going to look at some methods for finding not the exact solution, but approximations of the solutions. The first method is the method of Direction Fields and it will give us a good idea of what the solutions are going to look like. The second method, Euler’s method will give us an approximation to a single solution and we will be able to improve it to get arbitrarily good solutions to any differential equation (so long as there aren’t particularly nasty pathologies in the differential equation).

**Direction Fields**

Let’s take a differential equation:

Note that sometimes we will say explicitly that and sometimes we will leave it implicit, because the equation has a derivative of with respect to . You should become familiar with being able to spot which variable is a function of which other by looking at the derivatives.

Remember, what we are looking for is not just a function which solves a differential equation, but all functions which solve them. This means that for any value of and in the above equation, we can find a curve which locally has the derivative given by . We can’t yet solve for the whole curve, but we can solve for a tiny piece of it. This is what we will do when we look for a direction field. We’re going to look for little pieces of function which satisfy the differential equation. This might seem like a rather alien concept, but it will prove rather useful.

We know then that given a point and we can find the derivative there. Let’s say we pick the point ($3,2$). At this point, a function which solves the differential equation and goes through there will have gradient . We can think about drawing in a tiny bit of the function, let’s say a short line segment there with gradient .

We know that close to the point the function will still have gradient roughly 5, so drawing in a short straight line (ie. one where the gradient is constant) is going to be a reasonable approximation to whatever the function will really do there. Of course at the gradient will be a little more than 5, and at it will be a little less than 5, but that is the approximation we’re making.

We can go through a whole array of points in the plane and work out what the gradients of lines going through them will be. What we will be doing is actually mapping out all of the solutions to the differential equation.

Given an initial condition, of course we won’t go through all points in the plane, but we are now mapping out the flow of all possible initial conditions. Let’s do this for a grid of in the plane and work out the derivative of the function at those points:

We can then draw a plot in the plane of small lines, with these gradients, at these points. This will look like this:

If we want to see this in more detail then we can look at a larger number of grid points and we will find, for instance, the direction field in this figure:

You should get a general sense of the “flow” in these diagrams. You can image that a particular function is going to follow along a set of flow lines. In fact, the solution of this equation is known, and is .

Four different solutions with different initial conditions (ie. different values of ) are shown in figure the following figure on top of the direction fields.

You can thus see that given any first order differential equation, you can figure out the direction field by simply plugging in the and values. This will give the general behaviour of all solutions of the differential equation.

**Euler’s method**

The method of Direction Fields was a useful way to get the general behaviour of all solutions to a differential equation. Euler’s method is going to allow us to find an approximation of a particular solution given an initial condition. Let’s take the same equation that we had in the previous example:

but now we are going to ask what the solution which has initial condition (ie. at , ) looks like.

We know that close to this point, the gradient of the graph is going to be (ie. ), so we can draw a short line at that point with gradient .

Let’s draw a line of extension in the direction from the point with gradient . This is going to take us to the point At this point we again look at the differential equation and it tells us that the gradient at that point should be 0 (ie. ), so we draw a line with gradient 0 another unit in the direction, which takes us to the point . Again, we ask what the gradient should be at this point, and clearly it should be 1. We draw in a line of gradient 1 of length 1 which will take us to the point . We continue this again and again until we have got as far in the direction as we want.

Of course we chose to go unit in the direction each time but in fact this is a very crude approximation. We know that really the gradient will be changing continuously but we are letting it change only discretely. We could shorten the lines that we use, say to 0.5 long, or 0.1 long, or 0.01 long and each time it would give us a better and better approximation of the real solution to the differential equation. Various length sections for Euler’s method are shown in the following:

We will do more examples in class and please ask if the general idea here is not clear.

NikheilSeptember 28, 2015 at 5:08 pmWhy is it that (2,-1) which gives us a gradient of 1 take us to (2,0)? Why is it not (3,0)? a slope of one does not take us vertically up.

Jonathan ShockSeptember 29, 2015 at 5:51 amHi there, yes, indeed that should have been (3,0). Thank you for that.

J

UCT MAM1000 lecture notes subject links – MathemafricaApril 2, 2016 at 1:03 pm[…] MAM1000 lecture notes part 34 – Differential equations – direction flows and Euler’… […]