Applications: qualitative behavior
Paths in the plane
Paths in the plane
A classical set of applications of first-order ODEs involves finding paths through space with specific properties.
Link to original
Example
Catenary
Link to originalCatenary
Problem: A catenary is the shape formed by a hanging chain, string, or cable, and also the shape formed by a stable arch. A cable can only resist expansion forces directed along its length, while an arch can only resist compression forces directed along its length. What is the shape of a catenary?
Solution: Consider a hanging chain. Let be the tension force tangent to the chain at a point , and let be the horizontal component of the tension, so , where is the angle formed by the line tangent to the chain at .
The vertical balance of forces is more complicated. Set at the lowest point on the chain, and let measure the arclength of the chain with . At , the chain has a horizontal slope, so the vertical component of tension force there is zero. At , the vertical component of tension force is . The total vertical force on the portion of chain from the bottom up to is therefore , and this must balance the total weight of the chain from the bottom up to , which is , where is the chain density. So .
By dividing our two equations, we have . We may write for the slope of the tangent at . This gives us the differential equation . To solve this, we need to relate the arclength function to . Recall the arclength formula:
Plugging this in gives a differential equation that can be solved algebraically. The solution (family of curves) is:
If we set , i.e. the vertical position of the bottom of the chain, we can solve for and obtain:
Question
01
Link to originalSolve the ODE
Solve (algebraically) the ODE used to define the catenary curve.
(Hint: differentiate the function , substitute in, then use a reduction of order.)
Question
02
Link to originalArch vs. chain
Why does the St. Louis arch (or any other self-supporting arch) also have a catenary shape?
Example
Tractrix
Link to originalTractrix
A tractrix is a curve given by dragging a point behind a string of fixed length.
Problem: Suppose we drag the point behind a string of length . Suppose starts at , and we start at and walk in the direction. What is the shape of the path of ?
Solution: Write . The tangent line to the string at has slope given by
To see this, draw the triangle with vertices and and . The hypotenuse of this triangle is the string itself, and we are pulling from the top vertex.
This equation is separable, and the solution is:
Question
03
Link to originalPushing a pole
Suppose a pole is pushed from one end, with a free pivot on the end from which it is pushed. The shape of the path taken by the opposite end is also a tractrix. Why?
(Describe the concept of tractrix in such a way that it applies equally to dragging strings and pushing poles.)
Paths in the plane (part 2)
Catenary vs. tractrix
Link to original
The catenary curve is the evolute of the tractrix; the tractrix is the involute of the catenary.
https://en.wikipedia.org/wiki/Involute#Involute_and_evolute
Example
Pursuit curve
Link to originalPursuit curve
Problem: A gazelle runs up the -axis at speed starting at , and a cheetah runs towards the gazelle at speed starting at . What is the shape of the path taken by the cheetah?
Solution: The gazelle’s path can be given parametrically by the curve . Suppose the cheetah is at point . The vertical distance from cheetah to gazelle is , and the horizontal distance is .
We assume the cheetah is always running straight toward the gazelle, so the slope of the tangent line to the cheetah’s path is , and we obtain the differential equation:
This equation involves two independent variables, and , so we cannot immediately solve it. Of course they are related by the fact that is the -coordinate of the cheetah’s path. We would like to eliminate from the equation by substituting a formula for in terms of , , and quantities. This is the hard part.
We know that the cheetah is running at speed , so we also have the equation:
(Here we use for the arclength of the cheetah’s path.) This equation relates to the quantities , , and .
Now we seek to combine the equations. We can flip the second equation to obtain
If we differentiate the first equation in , we can make the disappear, with appearing instead:
Set . Reduce the order using and obtain:
Integrate this again to find , solving for the constant using the initial condition :
Question
04
Link to originalChecking algebra
Check the algebra for the solution of and then the integration for . (Write out all intermediate steps.)
Growth and decay
Growth and decay
Another classic application of differential equations produces exponential growth and decay. Variants on this theme can account for recurring additions and subtractions.
Link to original
Example
Growth of retirement fund with compound interest
Link to originalGrowth of retirement fund with compound interest
A quantity of money in a savings account with compound interest rate grows according to the differential equation . The solution of this equation is an exponential function , where is the initial quantity in the account.
Theory: Compound interest with continuous deposit or withdrawal
Suppose you make continuous deposits or withdrawals at a rate of (in dollars per year, with for deposits, for withdrawals). Now the equation is:This equation is linear and separable. The solution can be found algebraically:
If the account starts with , then and .
Achieving a retirement fund
Suppose this situation describes your Roth IRA. How much should you deposit in the account per year to achieve $800,000 after 40 years, with ? Answer:Constant rate of retirement withdrawal, with inflation
Suppose you have a retirement account with dollars, growing at the interest rate , and you plan to withdraw money at a rate which is increasing with inflation at per year, and starting at $80,000 per year. What should be to ensure you will have money for 30 years of retirement?This problem involves two exponential growths, one stemming from interest and the other from inflation. The rate of withdrawal satisfies , so per year. Then the account value satisfies:
This equation is linear. The solution is:
Setting , we can solve for . Then plugging in , obtain the equation:
Setting $80,000, , and , solve for and find $1,580,000.
Exercise
01
Link to originalDesign your traditional IRA
You are planning a traditional IRA for retirement: contributions during your working life are pre-tax, and withdrawals during retirement are taxed according to your income bracket when withdrawing. Your plan is to start the fund with $20,000 when you turn 30, and then to contribute a fixed yearly amount (modeled with a continuous yearly addition rate) each year until you turn 65. You invest the IRA in a broad market index with average yearly returns of 10% (not adjusted for inflation). Starting at age 65 you stop contributing and start withdrawing $70,000 per year after taxes for the next 25 years of retirement, and you would like to have $200,000 remaining in your estate at age 90, both figures measured in today’s dollars. Your tax bracket with this retirement income is 20%. Inflation is assumed to be a steady 2.5% per year. Everything is compounded continuously. What should you choose for the yearly contributions ?
Example
RC Circuits
Link to originalRC Circuits
An electrical circuit with a single resistor and a single capacitor is called an RC circuit:
Suppose the voltage source produces a voltage between its terminals, and write and for the voltage drops across the resistor and capacitor.By Ohm’s Law, , where is the current flowing through the resistor, and is the resistance of the resistor (a constant). The capacitor voltage drop satisfies , where is the charge stored in the capacitor, and is the capacitance of the capacitor (a constant). Current is the rate of flow of charge per unit time: .
By Kerchoff’s Voltage Law, we have an equation for the circuit:
So we find that charge satisfies:
which is a linear ODE. Solving this ODE and dividing by gives us a formula for :
Let us study this solution. The first term, , represents exponential decay from to . The second term depends on the source function . For example, if a constant, then the entire second term reduces to itself, and the solution will exponentially decay from down to .
Here is a Mathlet that shows the response when the source is a rectangular wave:
https://mathlets.org/mathlets/periodic-box/
Exercise
02
Link to originalBacteria growth on surface of spherical clump
A spherical clump of bacteria is growing in such a way that only the bacteria on its surface can reproduce, because only these are exposed to new food sources in the environment, while these surface bacteria do reproduce with exponential growth. Recall the formulas for volume and surface area of a sphere:
Find a differential equation satisfied by the number of bacteria as a function of time.
Autonomous equations
Autonomous equations
In a first calculus class, the sign of the derivative of a function is written on the number line in order to indicate places where is increasing or decreasing. This technique is useful for determining whether a critical point is a local min, max, or neither.
The same technique is used to study first-order autonomous differential equations. Autonomous equations having the form , meaning that the defining function does not involve the independent variable .
The main differences are: (i) for autonomous ODEs we have the derivative but we do not already have the function , and (ii) for autonomous ODEs we draw the signs of as vertical arrows (up or down) on a vertical line, instead of “” and “” on a horizontal line. We can add filled dots where , and open dots or dashed lines where , since these lines have special meaning.
This vertical number line we use to analyze is called a phase line. Phase lines can be used to make qualitative observations about the behavior of solutions to autonomous ODEs.
Lines corresponding to zeros of yield flat solutions. If the derivative is negative at such a line, i.e. , so cross through zero from above to below, then solutions will be attracted to the line . These lines are called stable equilibria. If then solutions will be repelled from the line. These lines are called unstable equilibria. (Sometimes stable equilibria are called sinks and unstable ones which are repulsive on both sides are called sources, while unstable ones that are repulsive on one side and attractive on the other side are called nodes.)
When , the equilibrium could be stable, unstable, or neither, and additional information is needed. The situation is the same as for critical points of a function that fails the second-derivative test.
Phase lines:
Phase lines with at :
Phase lines deduced from the graph of alone:
Logistic growth
Many natural systems experience exponential growth and decay only to first order. Once the exponential behavior has occurred for significant time, environmental effects of the growth or decay begin to modulate the rate of that growth or decay.Exponential growth satisfies the equation , where is a constant giving the growth rate. We can modify the equation to account for changes of growth rate that depend on the quantity by letting become a function .
Link to original
Example
Logistic curve - population dynamics
Link to originalLogistic curve: population dynamics
Modified exponential growth with a growth rate given by the linear function gives the logistic equation:
Using the theory of phase lines, we can study solutions to this equation without finding an explicit formula for them. Write , so . This number is sometimes called the carrying capacity of the population’s environment, because the growth rate will go negative when exceeds .
Now let us classify equilibrium points. We have . Compute
so and . Therefore is an unstable equilibrium, while is a stable equilibrium.
The logistic equation is separable, and it can be solved exactly and explicitly. Solutions are called logistic curves. These are given by:
Consider the interpretation of this formula. The initial value is . As , the second term in the denominator goes to zero. So as . This is true whether or .
It is useful to observe that the concavity of the solution trajectories can be ascertained from the formula for without actually solving the logistic equation. This relies on the chain rule:
For the logistic equation we are considering, this product is:
The inflection point is where this function changes sign, which is at , so the rate of population increase starts slowing down when the population is halfway to the carrying capacity of the environment.
Exercise
03
Link to originalStudying an autonomous equation
Sketch the phase line of the following ODE:
Classify each equilibrium trajectory as stable or unstable. Draw some representative solution trajectories using the qualitative information of your phase line.
Exercise
04
Link to originalGompertz equation
Tumor growth is sometimes modeled by the Gompertz equation:
What are the equilibrium lines? Are they stable or unstable? What is the inflection point on a trajectory from the lower to the upper equilibrium?
Now solve the equation explicitly.
Numerical techniques
Introduction
This section is about methods that can be used by a computer to produce numerical solutions to first-order IVPs, and more specifically, methods that are usually guaranteed at least some success and rely only on the ability to calculate the derivative by evaluating a given function . These methods work by starting at the initial value and iteratively building a solution, stepping forward in time to propose candidate values that depend on evaluations of at various points as well as the values at previous times.
Link to originalExtending partial functions in time vs. refining complete functions to higher orders
Later we will consider approximation methods of a different nature, namely power series (for example as produced by Picard iteration), and Fourier series.
Instead of building a solution out across time, producing future solution values during the process, these methods produce coefficients for infinite series that converge to the solution. A systematic approach along these lines was developed by Parker-Sochacki.
The methods of this section produce partial functions defined only up to a given time, and these partial functions are not updated in the past (at least not much), rather they are extended ever further forward. The power series methods produce complete functions, namely as partial sums of the series, but the values at early times are subject to revision as later terms are added, meaning that the complete functions are changed across all time with each further iteration.
Euler’s method
Euler’s method
The simplest imaginable algorithm for solving an IVP numerically is attributed to Euler. The method is simply to follow tangent lines.
Suppose the IVP is given by
We construct an approximate solution iteratively, using a step size of , as follows:
The process is iterated until reaches the desired stopping time .
Link to original
Question
01
Link to originalEuler’s method practice
Consider the IVP:
Use Euler’s method to compute an approximate solution up to with step size . Show all four steps of the partial solution.
Euler’s method (part 2)
Link to originalEuler’s method is not always accurate
The Euler method is very easy to implement on a computer or even a programmable calculator. It is frequently very inaccurate, however, since the errors can build up rapidly. With exponentially growing solutions, for example, the Euler method will fall far behind in a short time, even with a small step size.
Exercise
01
Link to originalEuler’s method struggles with large slopes
Consider the IVP:
Desmos: https://www.desmos.com/calculator/gbijdaprd3
- Use Euler’s method to compute an approximate solution at the times using .
- Use Euler’s method to compute an approximate solution at the times using .
- By considering the slope field, possibly in conjunction with an exact solution, can you explain why the approximate solutions differ so much at ?
Exercise
02
Link to originalEuler’s method becomes the left-endpoint rule
Show that if the ODE is amenable to solution by direct integration, meaning actually does not depend on , then Euler’s method amounts to the left-endpoint rule for integration of .
Heun’s method
Heun’s method
The function allows us to access slope values anywhere, but in Euler’s method we only use the slope value at the starting point of each step.
Instead of taking the slope at to extrapolate from , we can take the slope at both and . Well, this can’t quite be done because we don’t know in advance, but we could use the Euler method to forecast initially and call this , then take the slope , and finally compute the average slope at the two points. Then we extrapolate our next step from using this average slope instead of the slope . We obtain the formula:
This formula can be iterated from with step size until reaching the desired stopping time .
Link to original
Question
02
Link to originalHeun’s method practice
Consider the IVP:
Use Heun’s method to compute an approximate solution up to with step size . Show all four steps of the partial solution.
Question
03
Link to originalComparing methods
Solve algebraically the IVP as in the previous Questions: . Make a table of values to compare the results of Euler’s method, Heun’s method, and the exact solution. Write the percent error next to the values from the approximation methods. Create a final column that includes the percent difference between the approximate solutions. Can this column predict the percent error without knowing the exact solution?
Heun’s method (part 2)
Link to originalHeun’s method becomes the trapezoid rule
If the ODE is amenable to direct integration, so actually does not depend on , then Heun’s method amounts to the trapezoid rule for integration of .
Runge-Kutta methods
Runge-Kutta methods
The basic idea of Heun’s method is to capture more information from ahead of the given step . We want to use these candidate slope values in the vicinity of the point to better approximate the exact average slope, namely the value that gives the slope of the secant from the current step to the exact solution at the next step.
The idea of Heun’s generalization of Euler’s method can be extended to any number of stages, where a stage refers to the number of ‘forecasting’ evaluations of the function that are required for each step. The Euler method is 1-stage, and the Heun method is 2-stage.
The general name for -stage methods that generalize Heun’s method is Runge-Kutta methods. The most famous and widely used Runge-Kutta method is a choice of 4-stage method that sometimes is simply called the Runge-Kutta method. (So if no stage number is specified, this 4-stage method is implied.)
For this method, we sample 4 slope values, called :
- – slope at current step
- – slope at the Euler forecast using , half step
- – slope at the Euler forecast using , half step
- – slope at the Euler forecast using , full step
The final value for the next step is then: In other words, the slope we use to compute the next step is a weighted average of various slopes in the ‘future vicinity’ of .Link to originalThe possibilities are endless
There is no simple explanation for the choice of sampling locations and the choice of weights used for the final slope. Other possibilities are also studied.
Exercise
03
Link to originalThe Runge-Kutta method becomes the Simpson rule
Show that if the ODE is amenable to direct integration, so actually does not depend on , then the Runge Kutta method amounts to the Simpson rule for integrating .
Recall that the Simpson rule comes from fitting parabolas. It is given by:
Adams method: multistep: polynomial fitting
Adams method - multistep - polynomial fitting
The methods studied so far, Euler, Heun, and Runge-Kutta more generally, have been single step methods. This terminology means that each step of the iterative process makes use of the data of a single previous step. In the formulas above, was determined (through some process) by the value of alone.
A multistep method uses the data of multiple previous steps to estimate the next step. For example, a 3-step method would use , , in order to estimate .
Runge-Kutta is not multistep
Do not confuse the use of multiple estimated slopes with the use of multiple previous steps!
To simplify the formulas for multistep methods we define , so is a scalar quantity representing the slope given by the ODE at the previous step .
The most natural and common multistep method is produced by fitting a polynomial of degree to the slopes at the previous steps, namely to
and then extrapolating forward on this polynomial. This is called the Adams method.
Link to original
Example
Two-step Adams method
Link to originalTwo-step Adams method
We seek a parabola with three properties:
The graph of this parabola will pass through the previous step and match the slope of the ODE at the two previous steps and .
To find the coefficients of , first solve the system:
(Observe that the second and third equations are independent of the first, so they should be solved initially and the result used to compute from the first equation.) Obtain:
Then the next step value is given by evaluating the polynomial at :
This is the Adams formula for in terms of and .
Exercise
04
Link to originalThree-step Adams method
Compute the formula for the three-step Adams method.
Errors
Errors
Next we consider the accuracy of the above methods in a quantitative way. It is important to learn some vocabulary to refer to various sources of error, especially as users of numerical ODE solver packages.
- Local truncation error is error arising in the single step of the iterative solution procedure, assuming that the starting values of the previous step are accurate (or taking them for granted as initial conditions).
- Global truncation error is the accumulation of local truncation error as the procedure is iterated over steps.
- Round-off error is the accumulation of error due to finite-precision arithmetic operations performed along the way, as the procedure is iterated over steps.
- Total accumulated error is the difference between the approximate and the exact solutions at the ending time. It is satisfies where is the step number of the ending time.
The global truncation error is (in principle) some function of the local truncation error, since it measures the accumulation of that error.
Truncation errors are due to the mathematics of the approximation procedure. For a coherent procedure, the truncation errors should vanish in the limit as and the approximation converges to an exact solution. Truncation error is therefore reported in terms of powers of .
The “Big-O” notation is used to describe how quickly as . The ‘’ can be read as “order.” We say , read “ has the order of ,” when for some and .
With the Euler method, for example, we will see that and , so the Euler method is called a first-order method. It turns out that the Runge-Kutta method has , and it is therefore called a fourth-order method. Any method with is at worst a -order method. The goal in constructing Runge-Kutta methods is to minimize the number of calls to the function while maximizing the order of the global truncation error.
Local truncation error for the Euler method
Assume that are all continuous in the region of interest. Suppose is an exact solution to the IVP. Then , and the chain rule gives us:
Now consider the Taylor series with remainder of expanded around :
where is some value giving the remainder term.
The local error for Euler’s method is therefore:
So our local error bound is proportional to and to . Letting be the maximum of in the region of interest, we see that .
Link to originalLocal to global is not trivial
The relationship between local and global truncation errors is not quite as simple as it appears. You cannot derive that global is always one order lower than local by multiplying the global error by the number of steps (i.e. by ). The problem is that the constant appearing in the local truncation error order equation can vary dramatically over the course of a solution – it depends on the slope field in the region. To derive the global error from the local error, you have to know how quickly the local error can vary.
Adaptive methods
Adaptive methods
Some regions of the slope field demand a smaller for sufficient accuracy (for a sufficiently small local truncation error) than other regions. If the smallest necessary is chosen, the calculations will be much slower than would be possible in regions where an this small is not needed. Therefore, using a fixed step size is usually not the best practice for real implementations of numerical ODE techniques. Rather, it is best if the implementation can estimate the accuracy of its own calculation, and use this estimate to adjust the step size for an optimal balance of accuracy and efficiency.
A standard method to adapt the step size dynamically is to use a solution procedure that is one order better than required, together with a solution procedure that is just as required, and to compare the outputs. The difference of outputs gives an estimate of the actual local truncation error. It is a sort of detector of that error. When the local truncation error estimate gets too big, the step size is reduced; when it’s smaller than necessary, the step size is increased and the computation speeds up.
A very popular numerical solver called “RKF” (for Runge-Kutta-Fehlberg) uses a Runge-Kutta fourth-fifth order coupled procedure, where the data of the fourth-order procedure is reused for the fifth-order procedure and just a little more data added by function calls to . A famous FORTRAN implementation of this is called RKF45.
In Question 06-03 you already considered a part of this process. The Heun method uses the data from the Euler method, calling the function one more time. Since the Heun method is more accurate than the Euler method, the Heun solution can be used as a substitute for the exact solution, and the difference between Heun and Euler outputs gives an estimate for the local truncation error of the Euler method. If in this problem you had adjusted on the fly, depending on the error estimate, you would have had an adaptive method.
Link to original
Stability and stiff problems
Stability and stiff problems
Another concept is worth pondering in preparation for a scenario where you have to implement an ODE solver package.
- An IVP is stable if errors in the solution tend to decrease over time.
- An IVP is unstable if errors in the solution tend to increase over time.
Errors generated at early times in the solution approximation will propagate through the solution to later times. For some situations, the errors are shrinking down as the solutions are converging together. For other situations, the errors are growing, perhaps rapidly and without bound, as solutions are diverging from each other.
A perhaps unexpected fact is that an IVP can be stable in itself, and yet a solution procedure can generate instability. This is where exact solutions to the IVP that start with some difference end up converging together, but approximate solutions using the procedure actually end up diverging.
This means that the step size may have to be controlled to prevent the introduction of instability. A problem is called stiff when the step size needed to maintain stability is smaller than the step size needed to maintain numerical accuracy (local truncation error). Frequently a backward differentiation method is the best approach for a stiff problem; see Problem 06-03 to learn about those.
Link to original













