Ordinary Differential Equations (A BRIEF Refresher)

The general linear ODE is of the form:

general linear ODE

Here, n is the order of the system ant f(t) is the forcing function. If the forcing function vanishes, f(t)=0, and the equation is said to be homogeneous. Any or all of the a's may be functions of t.

The ODE alone does not represent a "problem". A complete problem must also include the initial and boundary conditions needed for solution.

In dynamic models used for control, we often see y as the independent variable, with time (t) as the independent variable. The forcing function may be broken up into several different additive parts representing the contributions of the different kinds of input (manipulations, disturbances, etc.)

Equations of order one and two are the most common in process control calculations; they can often be solved analytically in a hand calculation. This document tries to provde a cursory review of how to solve such problems.

First Order Linear ODEs

The linear first order ODE

linear 1st order ODE
has the solution
solution linear 1st order ODE
This solution can be used directly, or obtained using the integrating factor solution technique.

Integrating Factor

The integrating factor p is found by taking the exponential of the integral of the coefficient of the zeroth order term of the ODE

integrating factor
Multiply the ODE to be solved by its integrating factor
If the integrating factor is correct, the left hand side will be an exact differential
so that integrating both sides yields a solution
with one constant of integration, c1. Rearranging yields
A single initial condition (the value of x at t=0) can then be substituted to solve for the integration constant.

This method works whether or not the differential equation is homogeneous, as long as the forcing function(s) Q(t) permits analytical solution.


Example: The model for an isothermal, constant volume, CSTR with 1st order reaction is given by (see if you can derive it yourself)
CSTR
CSTR

The independent variable of interest is the composition in the reactor, CA. The forcing function is the composition of the reactor feed stream, CA0, which we will specify to be a step function. Set up initial conditions such that CA(0)=0 and the model can be integrated analytically to get an explicit solution for composition as a function of time.

Because we're thinking "process control", we'll define a time constant

Time Constant
before we find the integrating factor
integrating factor
Next, multiply through and simplify

integrate and rearrange

substitute the initial condition
initial condition
to find the constant of integration, then plug the constant back in to complete the solution
CSTR solution

Second Order Linear ODEs

Solving DEs of order greater than one relies on the fact that any linear combination of solutions of a DE is itself a solution. Consequently, the general solution to an ODE which is not homogeneous (a forced equation) can be obtained by adding the solution of the unforced homogeneous equation (the complementary solution) to a solution obtained considering the forcing function alone (the particular solution).

Finding the Complementary Solution

Consider the second order ODE given by

2nd Order ODE
The corresponding homogeneous (un-forced) equation is
homogeneous ODE
In process control, we usually rearrange this to the form
standard form
in terms of the time coefficient and damping coefficient.

Every 2nd order ODE has a characteristic or auxiliary equation written as a polynomial

characteristic equation
The roots of this equation (values of s that make it true) are used to write the complementary solution. This is
complementary solution
Two initial conditions (on x and its first derivative) are needed to evaluate the constants c1 and c2.

When the characteristic equation has complex roots (s=a+bi), it is often useful to write the solution using sines and cosines

complementary solution
where a is the real part of the complex root, b the complex part, and cR and ci are new constants related to c1 and c2 by
Usually it is just as easy to rearrange to the second form before using the boundary conditions and solve for cR and ci directly.

Finding the Particular Solution

If the forcing function of a nonhomogeneous equation forms the solution of a homogeneous linear DE, the "method of undetermined coefficients" can be used to get the particular solution. Basically, we assume a particular solution of the same form as the forcing function -- an unknown constant if the forcing function is a constant, a sum of sines and cosines if the forcing function is an oscillator, etc. The particular solution must be linearly independent of the complementary solution for this method to work.

For example

Another way to find xp is to repeatedly differentiate the forcing function and collect the resulting functions. Each of these is then multiplied by an undetermined coefficient and the sum (including the original forcing function) is used as the particular solution. For example, if f(t)=t2, differentiating once yields 2t and twice gives 2. This gives three terms, each of which is weighted by an unknown constant before being summed to get the particular solution

Notice that using the fourth example of an "assumed" solution, gives the same result this method would.

After obtaining the particular solution via either of these methods, you then have to plug the particular solution back into the ODE to evaluate the constants.

Summary: 2nd Order Linear ODEs

The solution routine for a linear ODE with constant coefficients is

  1. Find the roots of the characteristic equation
  2. Using these roots, write the complementary solution
  3. Assume a particular solution of the same form as the forcing function
  4. Plug the particular solution into the original equation to evaluate its constants
  5. Combine the complementary and particular solutions to get the full result
  6. Apply the initial conditions to evaluate constants from the complementary solution

Example: solve
Example

(1) Write and solve the characteristic equation.


(2) Write the complementary solution by inspection

complementary solution

(3) Assume a particular solution of the same form as the forcing function. In this example, the forcing function is a constant, so assume the particular solution is also a constant

particular solution

(4) Plug the particular solution into the original equation and evaluate c3.



(5) Combine the complementary and particular solutions to obtain the full solution to the original ODE

(6) Apply the initial conditions to evaluate the remaining constants. This will require differentiating the solution




The final solution is thus


References:

  1. Luyben, W.L., Process Modeling, Simulation and Control for Chemical Engineers (2nd Edition), McGraw-Hill, 1990, pp. 177-78, 182-83, 188-92.
  2. Rainville and Bedient, Elementary Differential Equations (6th Edition), Macmillan, 1981, pp. 36-40, 91-92, 121- 25.
  3. Rice and Do, Applied Mathematics and Modeling for Chemical Engineers, John Wiley, 1995, pp. 39-41, 61-787.

R.M. Price
Original: 10/12/93
Modified: 1/4/95; 5/13/2003, 8/27/2003

Copyright 2003 by R.M. Price -- All Rights Reserved

Validated