Andy's "DEs in a Day" page

From www.norsemathology.org

Jump to: navigation, search

Contents

Intro for those who've never had DEs

Q: What is a DE?

A: A DE is a differential equation, tying a function to its derivative(s). An ODE is an ordinary DE: it links function f(x) to its ordinary derivative(s), not any partial derivative(s).

Classic Example of an ODE: Population Growth

Assume that the increase in a population over a given short (instantaneous would be nice!) interval \left.h\right.is just proportional to the population itself: that is,

\left.P(t+h)=P(t) + P(t)\cdot h\cdot r\right.

Then

\left.P'(t)\approx \frac{P(t+h)-P(t)}{h} = \frac{P(t)\cdot h\cdot r}{h} = rP(t)\right..

In the limit as we let \left.h \rightarrow 0\right., we have

\left.P'(t) = rP(t)\right..

This is a classic and very important DE, which we now want to solve. When I asked my students how to solve this, they said "Separation of variables." I said "Don't be silly! Use the general method for solving DEs."

They said that they didn't know what that was, so I told them:

The general method for solving DEs is to stare at them until a solution comes to you. 

This is much faster than separation of variables: you simply ask yourself "Do I know a function which is essentially its own derivative, up to a constant?" To which I hope you reply to yourself "Of course! An exponential function."

\left.P(t) = \alpha e^{rt}\right..

We've found an infinite number of solutions. So now the question is, how do we choose between them? Well, we can't in the absence of more information. But if we have the initial value of the population, \left.P(0)\right. at time \left.t=0\right., then we can give the exact and unique solution,

\left.P(t) = P(0) e^{rt}\right..

We've solved the initial value problem.

Classic Example: the Simple Pendulum

You might visit this website, for a nice animation of this problem, along with several derivations. Mine is similar.

We'll derive this using a little vector calculus and a little bit of Newtonian physics. This image will do to give you the idea, but I actually think of it a little differently (thinking of the tension on the pendulum arm):

Image:Pendulum.gif

If we take as our origin the point on the ceiling to which the pendulum is attached, then the vector position of the pendulum bob is

\left.\underline{p}(t)=L\langle \sin(\theta(t)), -\cos(\theta(t))\rangle\right.

In the following, I'll suppress the dependence of \left.\theta\right. on time, replacing \left.\theta(t)\right. with \left.\theta\right. (for clarity).

\left.\underline{v}(t)=L\frac{d\theta}{dt}\langle \cos(\theta), \sin(\theta)\rangle\right.

\left.\underline{a}(t)=L
                      \left[
                      \frac{d^2\theta}{dt^2}\langle \cos(\theta), \sin(\theta)\rangle
                      +
                      \left(\frac{d\theta}{dt}\right)^2\langle -\sin(\theta), \cos(\theta)\rangle
                      \right]\right. or \left.\underline{a}(t)=L
                      \langle \frac{d^2\theta}{dt^2}\cos(\theta)-
                      \left(\frac{d\theta}{dt}\right)^2 \sin(\theta), 
                      \frac{d^2\theta}{dt^2}\sin(\theta)
                      +
                      \left(\frac{d\theta}{dt}\right)^2\cos(\theta)\rangle
                     \right.

Now we turn to the physics: Newton's second law is \left.\underline{F}=m\underline{a}\right..

The forces on the pendulum bob are gravity, operating in the negative y direction (of size mg, where m is the mass and g the acceleration due to gravity), and the tension (of size T) on the bob from the pendulum arm. The unbalanced forces give rise to accelerations. If we take the bob at rest, and move it to the right, then we can write the following for the force:

\left.\underline{F}=\langle -T\sin(\theta),T\cos(\theta)-mg\rangle\right.

where \left.\theta\right. is the displacement in angle. We equate the force and mass times acceleration and simplify to get \left.\langle -T\sin(\theta),T\cos(\theta)-mg\rangle=mL
                      \langle \frac{d^2\theta}{dt^2}\cos(\theta)-
                      \left(\frac{d\theta}{dt}\right)^2 \sin(\theta), 
                      \frac{d^2\theta}{dt^2}\sin(\theta)
                      +
                      \left(\frac{d\theta}{dt}\right)^2\cos(\theta)\rangle
                     \right.

Equating components, we get

\left.\frac{d^2\theta}{dt^2}\cos(\theta)-
                      \left(\frac{d\theta}{dt}\right)^2 \sin(\theta)=-\frac{T}{mL}\sin(\theta)
\right.

and

\left.\frac{d^2\theta}{dt^2}\sin(\theta)
                      +
                      \left(\frac{d\theta}{dt}\right)^2\cos(\theta)=\frac{T}{mL}\cos(\theta)-\frac{g}{L}
                     \right.

Our objective is to eliminate the term \left.\left(\frac{d\theta}{dt}\right)^2\right. from these two equations. We can do this by multiplying each by a trig function:

\left.\frac{d^2\theta}{dt^2}\cos^2(\theta)-
                      \left(\frac{d\theta}{dt}\right)^2 \sin(\theta)\cos(\theta)=-\frac{T}{mL}\sin(\theta)\cos(\theta)
\right.

and

\left.\frac{d^2\theta}{dt^2}\sin^2(\theta)
                      +
                      \left(\frac{d\theta}{dt}\right)^2\sin(\theta)\cos(\theta)=\frac{T}{mL}\sin(\theta)\cos(\theta)-\frac{g}{L}\sin(\theta)
                     \right.

Adding these two equations leads to magical results: we get elimination of the tension, components, too, and the result is (almost) our lovely ODE:

\left.\frac{d^2\theta}{dt^2}\left(\sin^2(\theta)
                      + \cos^2(\theta)\right)=-\frac{g}{L}\sin(\theta)
                     \right.

or, invoking Pythagoras,

\left.\frac{d^2\theta}{dt^2}=-\frac{g}{L}\sin(\theta)\right.

Strategies for Solution

The pendulum ODE is interesting, because our method of solution (staring) doesn't immediately give rise to a solution (at least I didn't stare one down). There are two approaches you can take (at least), when staring doesn't work (and so you give up on the exact solution):

  1. Replace the ODE with a related one that you like better, or
  2. Solve the one you've got numerically.

In either event, you're not actually solving the given ODE -- you're just hoping that your approximate method is giving you an estimate that is close enough for your purposes.

Linearize the ODE

As an example, using our pendulum problem, we could assume that \left.\theta\right. is small, and hence that (using Taylor series) \left.\sin(\theta) \approx \theta\right. (with error \left.O(\theta^3)\right.). Then our ODE

\left.\frac{d^2\theta}{dt^2}=-\frac{g}{L}\sin(\theta)\right.

is approximately given by

\left.\frac{d^2\theta}{dt^2}=-\frac{g}{L}\theta\right.

which I can stare down: solutions are sines and cosines. In fact, the general solution is

\left.\theta(t)=\alpha\sin(\omega t)+\beta\cos(\omega t)\right.,

where \left.\omega=\sqrt{\frac{g}{L}}\right..

This is a linear combination of the solutions we know, and works because the equation is linear. One way to know that you have a linear equation is if the linear combination of known solutions is another solution!

We may hope will be a good approximation so long as \left.\theta\right. is small (which means that you don't pull the bob too far from equilibrium -- its rest position).

The problem becomes an IVP, and we find a particular solution, when we know two things about our problem at \left.t=0\right. (usually the position and velocity). Two constraints allow us to find the two unknown coefficients \left.\alpha\right. and \left.\beta\right. (the general rule being that you need one constraint for each unknown).

Use Numerics

Alternatively we can use numerics. But in the process of approximating derivatives, etc., we're also not solving the given problem. On the other hand, we don't have to be nearly as clever as we were in using the Taylor series.

One additional problem in the pendulum problem is that we don't have a first-order problem (it's not about derivatives -- it's about second derivatives!). In this case, we can be clever and use a trick to turn the second-order ODE into a first-order system:

Let

\left.\gamma(t)=\frac{d\theta}{dt}\right.

Then

\left.\frac{d\gamma}{dt}=\frac{d^2\theta}{dt^2}\right.

Hence we have a system

\left.
\begin{bmatrix}
\frac{d\theta}{dt}\\
\frac{d\gamma}{dt}
\end{bmatrix}
=
\frac{d}{dt}
\begin{bmatrix}
\theta\\
\gamma
\end{bmatrix}
=
\begin{bmatrix}
\gamma\\
-\frac{g}{L}\sin(\theta)
\end{bmatrix}
\right.

This type of non-linear first-order ODE will be the typical subject of our numerical attacks.

Elementary Theory of Initial-Value Problems

The Big Picture

First of all we need to say a little about what differential equations and initial-value problems are, and the conditions under which they have solutions, and when those solutions are unique (it's nice to know that what you're hunting for is out there, and that it's alone).

Then we need to realize that, because we're solving these problems numerically, we're not going to be solving the given initial-value problem, but rather one close to that given (we call that a "perturbed" problem -- it's been jiggled, but hopefully not too badly).

So here is a brief overview of conditions under which solutions (or approximate solutions) of a perturbed problem will give reasonable information about the real problem.

Definitions

  • differential equation: an equation linking a function y and its derivatives and independent variables.
  • initial-value problem: with time as the independent variable, a differential equation as well as enough initial conditions to uniquely determine the solution.
  • well-posed initial-value problem: the initial-value problem

    \left(1\right)\qquad\qquad\qquad\qquad\qquad\frac{dy}{dt} = f(t,y), \quad a\le t\le b, \quad y(a)=\alpha

    is well-posed if

    • A unique solution y(t) exists, and
    • For any \left.\epsilon>0\right. there exists a positive constant \left.k(\epsilon)\right. such that whenever \left.|\epsilon_0|<\epsilon\right. and \left.\delta(t)\right. is continuous with | δ(t) | < ε on [a,b], a unique solution z(t) to

      \left(2\right)\qquad\qquad\qquad\qquad\qquad\frac{dz}{dt} = f(t,z)+\delta(t), \quad a\le t\le b, \quad y(a)=\alpha+\epsilon_0

      exists with
      \left.|z(t)-y(t)|<k(\epsilon)\epsilon, \quad \forall t \qquad \textrm{such\ that} \qquad a\le t\le b.  \right.

      The problem (2) is called a perturbed problem associated with the given problem.

  • Lipschitz condition: A function \left.
f(t,y)\right. satisfies a Lipschitz condition in \left.y\right. on a set \left.D \subset \R^2\right. if a constant \left.L>0\right. exists with
    \left.  	|f(t,y_1)-f(t,y_2)| \le L|y_1-y_2|  \right.
  • A set \left.D \subset \R^2\right. is said to be convex if whenever \left.(t_1,y_1)\right. and \left.(t_2,y_2)\right. belong to \left.D\right. and \left.\lambda\right. is in \left.[0,1]\right., the point \left.((1-\lambda)t_1+\lambda t_2,(1-\lambda)y_1+\lambda y_2)\right. also belongs to \left.D\right..

Theorems/Formulas

Theorem 5.4: Suppose that \left.
D=\{(t,y)|a\le t \le b,
-\infty<y<\infty\}\right. and that \left.f(t,y)\right. is continuous on \left.D\right.. If \left.f\right. satisfies a Lipschitz condition on \left.D\right. in the variable \left.y\right., then the initial value problem has a unique solution \left.y(t)\right. for \left.a\le t \le
b\right..

Theorem 5.3: If \left.f(t,y)\right. is defined on a convex set \left.D
\subset \R^2\right.. If a constant \left.L>0\right. exists with


	\left| \frac{\partial f}{\partial y}(t,y) \right| \le L \quad
	\forall (t,y) \in D,

then \left.f\right. satisfies a Lipschitz condition in \left.y\right. on \left.D\right. with Lipschitz constant \left.L\right..

Theorem 5.6: Suppose that \left.D=\{(t,y)|a\le t \le b,
-\infty<y<\infty\}\right. and that \left.f(t,y)\right. is continuous on \left.D\right.. If \left.f\right. satisfies a Lipschitz condition in \left.y\right. on \left.D\right., then the initial value problem (1) is well-posed.

Properties/Tricks/Hints/Etc.

So the up-shot is that our initial-value problem satisfies a Lipschitz condition, we're in good shape: we're going to be able to get an approximation numerically.

Personal tools