10.5 Differential Equationsap Calculus



  1. Consider the differential equation (3 )cos dy yx dx. Let yfx be the particular solution to the differential equation with the initial condition f (0) 1. The function f is defined for all real numbers. (a) A portion of the slope field of the differential equation is given below. Sketch the solution curve through the point 0,1.
  2. Why differential calculus?. Economic models assume rational optimizers –Consumers maximize utility –Producers maximize profits. (10.5 ).5 102.5(2 ) 10.

We will first deal with a first order differential equation by which we mean, specifically, an equation of the form (y'(x) = f(x, y)), for some function (f). Suppose, further, that we know the solution at some point (z).

This tells us, that in the interval in (x) starting at (z) and ending at (z + d) for very small (d), we have, approximately

[y(z + d) - y(z) = f(z, y) d]

10.5 = 3(1 3) – 2.5(1) + 9(1) + C; 10.5 = 3 – 2.5 + 9 + C; C = 1; The solution to the differential equation is y = 3x 3 – 2.5x 2 + 9x + 1.

We can use this 'linear approximation' to compute (y(z + d)), and then continue to compute (y(z + 2d)) from it, and so on.

This approach is like the left hand rule for doing integrals; the only difference is that (y) itself appears in (f).

To implement this you let (x) increase from its start value by (d) from row to row and have (y) increase by (f(x,y)d).

Exercise 19.1 Set this up for (f(z+y)) given by (xy) and plot (y) vs (x). (This represents the differential equation: (y'=yx), which has solution (lny = x + c). Start at (x=1, y=1) and find (y(2)) numerically and exactly from that solution, and compare.

It is a little more difficult to produce the analogue of the right hand rule, or trapezoid or Simpson's rule, since they require evaluating (f) and hence (y) beyond (z), and we only start with (y(z)) and (y(z+d)) is what we want to discover. If we put (y(z+d)) in our formula for computing (y(z+d)) the computer will accuse us, rightly, of using a circular reference.

There are ways to get around this and a whole sequence of formulae are known for evaluating (y(x+d) - y(d)) given our equation to any order in (d). These are called Runge-Kutta rules, and are very effective. You can see how they do in the accompanying applet.

We will only describe the simplest correction, namely approximate (y(z+d)) according to

[y(z+d) = y(z) + frac{d}{2}(f(z,y(z)) + f(z+d,y(z)+f(z,y(z))d)]

This means we are using (f(z,y(z))) as the derivative of (f) throughout the interval between (z) and (z+d) in approximating the value of (y(z+d)) in the last term above.

This is still pretty easy to do, and is more or less like the trapezoid rule, differing only in that we are estimating the derivative (f) at argument (z+d) rather than knowing it.

What do you do if you don't know (y(z)) at all?

You can get a feel for what all solutions are by making a plot in two dimensional space, one dimension being (z) and the other (y(z)). If you choose a grid of points in this plot, at each point you know the derivative (f(z,y(z))). If you draw an arrow pointing in the direction (frac{dy}{dx} = f(z,y(z))). You can then connect the arrows (like connecting dots), forming paths, and these paths each represent solutions to the differential equation.

Differential

These paths cannot cross.

Exercise 19.2: Figure out why paths cannot cross.

But they have can have some interesting features. Fixed points are one such feature and are what we saw in Chapter 18. A fixed point is one for which the equation implies you stay there. A stable fixed point is one such that if you are near it you rotate or spiral into it. There are also things called attractors, which are curves either in the past or the future (when the independent variable is time) which many paths crowd into. A stable fixed point is a kind of attractor.

You tell me I can implement the integration you described on a spreadsheet?

Yes. Put First order ODE in A1; xstart in A2; ystart into A3; d into A4. Put your data, which consists of the starting values of (x) and (y), and your choice for (d) in B2, B3, and B4.

Then start columns at A6, B6, C6, which will contain (x) and (y) respectively. In A6, put x; in B6, put y (trapezoidal rule); in C6, put y (left-hand rule).

So, you can put =B2 into A7, =B3 into B7, and =A7+$B$4 into A8 and copy it down column A.

In B8 put =B7+$B$4/2*(f(A7,B7)+f(A7+$B$4,B7+f(A7,B7)*d) and copy that down column B. That is it.

You can compare the result with the left hand rule computation by setting up column C and starting with =B7 into C7, but putting =C7+$B$4*f(A7,C7) into C8 and copying it down. Then you can make an (x,y) scatter chart of all three columns, and see what happens. The difference between the two computations gives you an impression of how bad the simpler one is.

You can see that it takes a bit more work to change functions (f), but is quite easy to change initial conditions. Here is the result for (f'(x) = xy) with (d = 0.01) and a starting point at (x = 1), (y = 1).

Number of steps
Number of digits after decimal point

Exercises 19.3 Set this up for (f(x, y) = x^2y), and for (f(x,y) = xsin(x, y)), starting at (x=0, y=1).

Does this always work?

No. For lots of interesting equations it is fine. However, sometimes your variable (y) can go to infinity, and then the calculation becomes quite inaccurate.

This can happen because, we are allowing any equation for (y'), and hence any equation for (left(frac{1}{y}right)'). Which means (frac{1}{y}) can sometimes be (0). If (frac{1}{y}) should happen to go through (0), then (y) will go to infinity without any particular reason for it.

Most of the time you can avoid this difficulty by solving the differential equation for (frac{1}{y}) while you are solving the one for (y). When (y) goes to infinity, (frac{1}{y}) is quite tame and is near (0) (remember that(left(frac{1}{y}right)') is (frac{-y'}{y^2}), so that if we let (frac{1}{y}) be (u), then (u) obeys (u' = -fleft(x,frac{1}{u}right)u^2)). If you do this you can use as next (y) value the one you get from the smaller of (y) and (frac{1}{y}).

Anyway, integrating differential equations this way is sufficiently easy that it is worth a try.

A Differential Equation is an equation with a function and one or more of its derivatives:


Example: an equation with the function y and its derivativedydx

Solving

We solve it when we discover the functiony (or set of functions y).

There are many 'tricks' to solving Differential Equations (if they can be solved!).

But first: why?

Why Are Differential Equations Useful?

In our world things change, and describing how they change often ends up as a Differential Equation:

Example: Rabbits!

The more rabbits we have the more baby rabbits we get.

Then those rabbits grow up and have babies too! The population will grow faster and faster.

The important parts of this are:

  • the population N at any time t
  • the growth rate r
  • the population's rate of change dNdt

Think of dNdt as 'how much the population changes as time changes, for any moment in time'.


Let us imagine the growth rate r is 0.01 new rabbits per week for every current rabbit.

When the population is 1000, the rate of change dNdt is then 1000×0.01 = 10 new rabbits per week.

But that is only true at a specific time, and doesn't include that the population is constantly increasing. The bigger the population, the more new rabbits we get!

When the population is 2000 we get 2000×0.01 = 20 new rabbits per week, etc.

So it is better to say the rate of change (at any instant) is the growth rate times the population at that instant:

dNdt = rN

And that is a Differential Equation, because it has a function N(t) and its derivative.

And how powerful mathematics is! That short equation says 'the rate of change of the population over time equals the growth rate times the population'.

Differential Equations can describe how populations change, how heat moves, how springs vibrate, how radioactive material decays and much more. They are a very natural way to describe many things in the universe.

What To Do With Them?

On its own, a Differential Equation is a wonderful way to express something, but is hard to use.

10.5 differential equations ap calculus practice

So we try to solve them by turning the Differential Equation into a simpler equation without the differential bits, so we can do calculations, make graphs, predict the future, and so on.

Example: Compound Interest

Money earns interest. The interest can be calculated at fixed times, such as yearly, monthly, etc. and added to the original amount.

This is called compound interest.

But when it is compounded continuously then at any time the interest gets added in proportion to the current value of the loan (or investment).

And as the loan grows it earns more interest.

Using t for time, r for the interest rate and V for the current value of the loan:

dVdt = rV

And here is a cool thing: it is the same as the equation we got with the Rabbits! It just has different letters. So mathematics shows us these two things behave the same.

Solving

The Differential Equation says it well, but is hard to use.

10.5 differential equationsap calculus calculator

But don't worry, it can be solved (using a special method called Separation of Variables) and results in:

V = Pert

Where P is the Principal (the original loan), and e is Euler's Number.

So a continuously compounded loan of $1,000 for 2 years at an interest rate of 10% becomes:

V = 1000 × 1.22140...

So Differential Equations are great at describing things, but need to be solved to be useful.

More Examples of Differential Equations

10.5 Differential Equationsap Calculus

The Verhulst Equation

Example: Rabbits Again!

Remember our growth Differential Equation:

dNdt = rN

Well, that growth can't go on forever as they will soon run out of available food.

So let's improve it by including:

  • the maximum population that the food can support k

A guy called Verhulst figured it all out and got this Differential Equation:

dNdt = rN(1−N/k)

The Verhulst Equation

Simple Harmonic Motion

In Physics, Simple Harmonic Motion is a type of periodic motion where the restoring force is directly proportional to the displacement. An example of this is given by a mass on a spring.

Example: Spring and Weight

A spring gets a weight attached to it:

  • the weight gets pulled down due to gravity,
  • as the spring stretches its tension increases,
  • the weight slows down,
  • then the spring's tension pulls it back up,
  • then it falls back down, up and down, again and again.

Describe this with mathematics!

The weight is pulled down by gravity, and we know from Newton's Second Law that force equals mass times acceleration:

F = ma

And acceleration is the second derivative of position with respect to time, so:

F = m d2xdt2

The spring pulls it back up based on how stretched it is (k is the spring's stiffness, and x is how stretched it is): F = -kx

The two forces are always equal:

m d2xdt2 = −kx

We have a differential equation!

It has a function x(t), and it's second derivatived2xdt2

Note: we haven't included 'damping' (the slowing down of the bounces due to friction), which is a little more complicated, but you can play with it here (press play):

Creating a differential equation is the first major step. But we also need to solve it to discover how, for example, the spring bounces up and down over time.

Classify Before Trying To Solve

So how do we solve them?

It isn't always easy!

Over the years wise people have worked out special methods to solve some types of Differential Equations.

So we need to know what type of Differential Equation it is first.

It is like travel: different kinds of transport have solved how to get to certain places. Is it near, so we can just walk? Is there a road so we can take a car? Or is it in another galaxy and we just can't get there yet?

So let us first classify the Differential Equation.

Ordinary or Partial

The first major grouping is:

  • 'Ordinary Differential Equations' (ODEs) have a single independent variable (like y)
  • 'Partial Differential Equations' (PDEs) have two or more independent variables.

We are learning about Ordinary Differential Equations here!

Order and Degree

Next we work out the Order and the Degree:

Order

The Order is the highest derivative (is it a first derivative? a second derivative? etc):

Example:

dydx + y2 = 5x

It has only the first derivative dydx , so is 'First Order'

Example:

d2ydx2 + xy = sin(x)

This has a second derivative d2ydx2 , so is 'Order 2'

Example:

d3ydx3 + xdydx + y = ex

This has a third derivative d3ydx3 which outranks the dydx , so is 'Order 3'

Degree

The degree is the exponent of the highest derivative.

Example:

(dydx)2 + y = 5x2

Differential Equations Examples

The highest derivative is just dy/dx, and it has an exponent of 2, so this is 'Second Degree'

In fact it is a First Order Second Degree Ordinary Differential Equation

Example:

d3ydx3 + (dydx)2 + y = 5x2

The highest derivative is d3y/dx3, but it has no exponent (well actually an exponent of 1 which is not shown), so this is 'First Degree'.

(The exponent of 2 on dy/dx does not count, as it is not the highest derivative).

So it is a Third Order First Degree Ordinary Differential Equation

Be careful not to confuse order with degree. Some people use the word order when they mean degree!

Linear

It is Linear when the variable (and its derivatives) has no exponent or other function put on it.

So no y2, y3, √y, sin(y), ln(y) etc, just plain y (or whatever the variable is).

Differential Equations Solver

More formally a Linear Differential Equation is in the form:

dydx + P(x)y = Q(x)

Solving

OK, we have classified our Differential Equation, the next step is solving.

And we have a Differential Equations Solution Guide to help you.