Mathematics for Engineers

Differential equations


Equations that can be integrated


Suppose that we are given the constant acceleration of a train and wish to know the velocity and position at future time t.

We start with the equation

\ddot{x}=a

where each 'dot' means differentiation with respect to time.

We can integrate this directly to get the velocity ẋ as a function of time

\dot{x}=at+b

where b is a constant that we have to include to represent the velocity at time t=0.

We can integrate this a second time to get the position

x=\frac{1}{2}at^2+bt+c

and now we have to include c, the position x at time t=0.

The solution is in two parts.  The first is the Particular Integral, the result of applying the input a to the system.

The second is the Complementary Function, here

bt + c

that would have described the position of the train if it had coasted along without any acceleration.

This system is 'second order', with the result that we have to introduce two variables to match the output to the Initial Conditions, here the position and speed at t=0.

A harder problem

Real life systems are seldom as easy as a constant input.  The acceleration will usually depend on the present values of the variables of a system, such as air resistance depending on the velocity or spring force depending on the displacement.

Often it can be impossible to find an 'analytic' solution - a mathematical function - so it might be necessary to 'simulate' the system to get a numerical result.  Here a second-order system would be broken down into two first-order equations in the 'state variables', position x and velocity v.  Taking the train example above we could write

\\\dot{x}=v \\
                      \dot{v}=a

and then at each time-step dt, add v*dt to x and a*dt to v.  Note that we still need two initial conditions.

But when the interactions are 'linear', i.e. are just proportional to the variables, we arrive at a 'homogeneous differential equation' which is straightforward to solve.

Homogeneous differential equations.

A homogeneous differential equation is one in which derivatives appear 'alone', only multiplied by constants and not as higher powers or products.  An example is

\ddot{x}+ 5\dot{x}+6x =
                      0

This might represent a mass-spring-damper system where the spring produces a restoring force proportional to displacement and the damper adds a force opposing the velocity.

The method relies on noting that the time derivative of

x = emt

is

ẋ = memt

so that each time we differentiate we pick up an extra m.

If we guess that x might be of this form, our equation becomes

m2emt + 5memt + 6emt = 0

or

(m2 + 5m +6)emt = 0

Now we do not want emt to be zero, so our equation is solved if

(m2 + 5m +6) = 0

You should be able to spot that the two 'roots' of this equation are

m = -2

and

m = -3

so to fit the equation, x could be e-2t or e-3t

Or it could be a mixture of both.  In fact by setting x to be

x = Ae-2t + Be-3t

we can choose A and B to fit the two initial conditions.

Try this exercise.  Click on the question mark to see the answer.


ẍ + 5ẋ + 4x = 0

where at time t = 0, x = 3 and ẋ = 0

?



But it isn't all plain sailing


Now try

ẍ + 4ẋ + 4x = 0

where at time t = 0, x = 2 and ẋ = 0


This time there are repeated roots of -2.

We no longer have two functions with two variables A and B to fit to the initial conditions.  What has gone wrong?

If we try substituting

x = te-2t

into the differential equation, we find that it fits.  (But only if there are repeated roots!)

So now we can write the solution as

x = Ae-2t + Bte-2t

and still get our two equations for the initial conditions.

So what else can go wrong?

Complex roots

Suppose we try

ẍ + 2ẋ + 5x = 0

If we apply the formula for solving am2+bm+c=0

m = (-b +/- root(b2 - 4 ac)/2a

we find roots

-1 + 2j

and

-1 - 2j

We now have exponentials of complex numbers!

But you have to remember that

e(-1+2j)t = e-te2jt

and that

e2jt = (cos 2t + j sin 2t)

and

e-2jt = (cos 2t - sin 2t)

so the solution boils down to

x = e-t(Acos 2t + B sin 2t)


The particular integral

Since mentioning 'Homogeneous Equations' we have let the input to our system be zero.

The functions that we have found are the 'Complementary Function', the function of time that represents the dying transient of a system that is undisturbed.  (Of course an unstable system does not die away!!)

To get the complete solution, we have to find a 'particular integral' that can fit the equation.  Then we can add the Complementary Function to match up the initial conditions.

In the train example at the top, this was at2/2, which when differentiated twice gives the acceleration a.

But in a vibration question, we are more likely to apply a sine wave than a constant.

The answer to an exam or assignment question might not even require the complementary function, since it is the response after any initial transient has died away that is important.

But finding the solution could be tough.

Consider the equation

sine input

We have already found the complementary function higher up, but now we need a particular integral.

Since we are pumping a sine wave into the system with a frequency of one radian per second, we can expect the output to be a similar sinewave.  But it is likely to have a phase-shift.

There are several ways to represent it mathematically.  One is as

x= a cos t + b sin t

while another is as

x = c cos (t + phi)

where phi is a phase angle in radians.

Using either of these is hard work - try them both.

You should get an answer

x = 0.1 cos t + 0.1 sin t

which is the same as

x = 0.1414 cos( t - pi/4)

But if you are brave enough to face up to complex numbers, there is a much easier way.


Yet more complications


Suppose that we have the following system with an input at its 'resonant frequency':

ẍ + x = sin t

If we look for a mixture of sin t and cos t for x, we end up with an answer that is infinite!  Try it.

Once again an extra t has crept into the answer, which has a particular integral

x = - (t cos t)/2

When you apply the input, the output does not suddenly jump to infinity.  It winds up linearly with time, so that it would reach infinity an infinite time later, if something did not limit or break first.

SolutionWhy that is the solution


Differential equations have two parts to their solution.

One part is called the 'complementary function' and is the solution when the left-hand-side is equated to zero.

The other part is the 'particular integral' and represents the response to the function that is applied on the right-hand-side.

So in this case the CF is the solution of

d2x/dt2 + x = 0

while the PI is any function you can find to satisfy

d2x/dt2 + x = sin(t)

But sin(t) and cos(t) both satisfy the CF equation - so a mix of these will not do!

But if we try x = t.cos(t) what do we get?

dx/dt = -t.sin(t) + cos(t)

and

d2x/dt2 = -t.cos(t) - sin(t) - sin(t)

so

d2x/dt2 + x = -2.sin(t)

so the actual answer we want is x = -t.cos(t)/2

Of course you can have additional sin(t) and cos(t) terms to fiddle to match the initial conditions - that is what the CF is for.