3 Inhomogeneous Linear Differential Equations: The Forced Harmonic Oscillator
Tải bản đầy đủ - 0trang
148
Mathematics for Physical Chemistry
✬
✩
TABLE 12.1 Particular Trial Solutions for the Variation of Parameters
Inhomogeneous term
Trial solution
1
A
tn
A 0 + A1 t + A2 t + · · · + An
e αt
Ae αt
t net
e αt (A
e αt sin (βt )
e αt [A cos (βt ) + B sin (βt )]
α,β
e αt
e αt [A cos (βt ) + B sin (βt )]
α,β
cos (βt )
✫
Forbidden characteristic root
0
0
+ A1 t + A2 t + · · · + An
(ω2 − α 2 )A cos (αt) + ω2 − α 2 B sin (αt)
F0 sin (αt)
,
m
where we have replaced k/m by ω2 . This can be a valid
equation for all values of t only if A = 0 and if
F0
.
m(ω2 − α 2 )
The particular solution is
z p (t) =
α
✪
F0 α
,
m(ω2 − α 2 )
F0 α
vz (0)
−
.
b2 =
ω
mω(ω2 − α 2 )
Substitution of this into the inhomogeneous equation gives
−α 2 A cos (αt) − α 2 B sin (αt)
k
A cos (αt) + B sin (αt)
+
m
F0 sin (αt)
=
,
m
t n)
vz (0) = b2 ω +
z p = A cos (αt) + B sin (αt).
B=
0
α
Use of Table 12.1 gives the particular solution
=
tn
Exercise 12.11. Find an expression for the initial velocity.
The solution in the previous example is a linear
combination of the natural motion and a motion proportional to the external force. If the frequencies of
these are not very different, a motion such as shown in
Figure 12.5, known as beating, can result. There is a
periodic variation of the amplitude of vibration with a
circular frequency equal to ω − α. You can hear this beating
when a piano is being tuned. There are two or three strings
for each note, and they are tuned separately. Each string
can excite a sympathetic vibration in the other, which acts
as an external force. When the frequencies of two strings
are slightly different, you can hear a pulsation like that in
Figure 12.5, which shows the case that α = 1.100ω.
F0
sin αt .
− α2 )
m(ω2
z
The general solution is
F0
sin αt ,
m(ω2 − α 2 )
(12.63)
where the constants b1 and b2 are to be determined by
the initial conditions. Let us assume that z(0) = 0, so that
b1 = 0.
z(t) = b1 cos(ωt) + b2 sin(ωt) +
t
F0
sin αt ,
− α2 )
dz
F0 α
= b2 ω cos(ωt) +
cos αt .
vz (t) =
dt
m(ω2 − α 2 )
z(t) = b2 sin(ωt) +
m(ω2
The constant b2 would be determined by another initial
condition on vz (0)
FIGURE 12.5 The position of a forced harmonic oscillator as a function
of time for the case α = 1.1ω.
CHAPTER | 12 Differential Equations
149
12.4 DIFFERENTIAL EQUATIONS WITH
SEPARABLE VARIABLES
In this section we discuss equations that can be manipulated
algebraically into the form
g(y)
dy
= f (x),
dx
(12.64)
where g(y) is a known integrable function of y, f(x) is a
known integrable function of x, and y(x) is the unknown
function. To solve Eq. (12.64), we symbolically multiply
both sides of the equation by dx and use the relation:
dy
dx = dy.
dx
(12.65)
(12.66)
If we have manipulated the equation into this form, we
say that we have separated the variables, because we have
no x dependence in the left-hand side of the equation and
no y dependence in the right-hand side. We can perform
an indefinite integration on both sides of this equation to
obtain
g(y)dy =
f (x)dx + C,
(12.67)
where C is the difference of two constants of integration.
We could do a definite integration
y2
y1
g(y)dy =
x2
f (x)dx,
1
dc = ln (c) = −k
c
ln (c) = −kt + C,
dt + C = −kt + C,
where C is a constant of integration. We take the exponential
of each side of this equation to obtain
eln (c) = c = eC e−kt = c(0)e−kt ,
c(t) = c(0)e−kt .
(12.71)
A definite integration can be carried out instead of an
indefinite integration:
c t1
We now have
g(y)dy = f (x)dx.
We perform an indefinite integration
c(0)
c(t1 )
1
dc = ln
c
c(0)
= −k
t1
0
dt = −kt1 .
The limits on the two definite integrations must be done
correctly. If the lower limit of the time integration is zero,
the lower limit of the concentration integration must be the
value of the concentration at zero time. The upper limit is
similar.
Exercise 12.12. In a second-order chemical reaction
involving one reactant and having no back reaction,
−
dc
= kc2 .
dt
Solve this differential equation by separation of variables.
Do a definite integration from t = 0 to t = t1 .
(12.68)
x1
where
y1 = y(x1 ),
(12.69)
y2 = y(x2 ).
(12.70)
The result of this integration is an algebraic equation
that can be solved for y as a function of x.
Example 12.9. In a ﬁrst-order chemical reaction with
no back reaction, the concentration of the reactant is
governed by
dc
− = kc,
dt
where c is the concentration of the single reactant, t is the
time, and k is a function of temperature called the rate
constant. Solve the equation to find c as a function of t.
We divide by c and multiply by dt to separate the
variables:
1
1 dc
dt = dc = −k dt.
c dt
c
If you are faced with a differential equation and if you
think that there is some chance that separation of variables
will work, try the method. If it doesn’t work, you haven’t
lost very much time.
12.5 EXACT DIFFERENTIAL EQUATIONS
Sometimes an equation can be manipulated into the Pfafﬁan
form:
M(x,y)dx + N (x,y,)dy = 0.
(12.72)
Some such differential forms are exact, which means that
they are differentials of functions, as explained in Chapter
8. Other differentials are inexact , which means that they are
not differentials of any function. If the differential is exact,
the equation is called an exact differential equation. The
test for exactness is based on the Euler reciprocity relation,
as in Eq. (8.29): If
∂M
∂y
=
x
∂N
∂x
,
y
(12.73)
150
Mathematics for Physical Chemistry
then the differential is exact. If the differential equation is
exact, there is a function f(x,y) such that
d f = M(x,y)dx + N (x,y)dy = 0,
(12.74)
f (x,y) = x 2 y = k,
(12.75)
where k is a constant. We solve this algebraic equation to
obtain our general solution:
which implies that
f (x,y) = k,
where k is a constant, because a constant function has a
differential that vanishes. This equation can be solved for
y in terms of x, providing a solution to the differential
equation.
In Chapter 9 we discussed the procedure for finding the
function in Eq. (12.75) by using a line integral,
f (x1 ,y1 ) = f (x0 ,y0 ) +
df,
(12.76)
C
where C represents a curve beginning at (x0 ,y0 ) and ending
at (x1 ,y1 ). A convenient curve is the rectangular path from
(x0 ,y0 ) to (x1 ,y0 ) and then to (x1 ,y1 ). On the first part of
this path, y is constant at y0 , so the dy integral vanishes and
y is replaced by y0 in the dx integral. On the second part of
the path, x is constant at x1 , so the dx integral vanishes and
x is replaced by x1 in the dy integral:
x1
f (x1 ,y1 ) = f (x0 ,y0 ) +
M(x,y0 )dx
x0
+
y1
N (x1 ,y)dy.
where k is a constant. We drop the subscripts on x1 and y1
and consider x0 and y0 to be constants:
(12.77)
y0
y = k/x 2 .
Some condition would have to be specified to obtain the
value of k.
Exercise 12.13. Solve the equation (4x +y)dx +x dy = 0.
12.6 SOLUTION OF INEXACT
DIFFERENTIAL EQUATIONS USING
INTEGRATING FACTORS
If we have an inexact differential equation
M(x,y)dx + N (x,y)dy = 0,
we cannot use the method of the previous section. However,
some inexact differentials yield an exact differential when
multiplied by a function known as an integrating factor. If
the function g(x, y) is an integrating factor for the differential
in Eq. (12.78), then
g(x,y)M(x,y)dx + g(x,y)N (x,y)dy = 0
Both integrals are now ordinary integrals. If we can perform
the integrations, we will have an algebraic equation that
can be solved for y as a function of x. The solution will
contain an arbitrary constant, because the same constant can
be added to f (x1 ,y1 ) and f (x0 ,y0 ) in Eq. (12.77) without
changing the equality.
Example 12.11. Solve the differential equation
y
dy
= .
dx
x
We convert the equation to the Pfaffian form,
2x y dx + x 2 dy = 0.
y dx − x dy = 0.
The equation is exact, because
∂
∂ 2
(2x y) = 2x and
(x ) = 2x,
∂y
∂x
so that the Pfaffian form is the differential of a function
f = f (x, y).We do a line integral from (x0 ,y0 ) to (x1 ,y0 ) and
then to (x0 ,y1 ):
=
=
x1
2x y0 dx +
x0
y0 x12
x12 y1
−
−
y0 x02
x02 y0
(12.79)
is an exact differential equation that can be solved by the
method of the previous section. A solution for Eq. (12.79)
will also be a solution for Eq. (12.78).
Example 12.10. Solve the differential equation
f (x1 ,y1 ) − f (x0 ,y0 ) =
(12.78)
+
y1
x12 dy = 0
y0
x12 y1
= 0,
− x12 y0 = 0
We test for exactness:
∂y
∂y
x
∂( − x)
∂x
y
= 1,
= −1.
The equation is not exact. We now show that 1/x 2 is an
integrating factor. Multiplication by this factor gives
y
dx −
x2
1
dy = 0.
x
CHAPTER | 12 Differential Equations
151
This is an exact differential of a function f = f (x, y), since
1
,
x2
1
= 2.
x
y
∂(y/x 2 )
∂y
∂( − 1/x)
∂x
String position
given by y = y (x , t)
=
x
y
We can solve this equation by the method of the previous
section:
x1
y1 1
y0
dx
−
dy = 0
f (x1 ,y1 ) − f (x0 ,y0 ) = s
2
x0 x
y0 x 1
y0
y0
y1
y0
= − +
−
+
=0
x1
x0
x1
x1
y0
y1
=
−
= 0.
x0
x1
We regard x0 and y0 as constants, so that
y
y0
=
= k,
x
x0
where k is a constant. We solve for y in terms of x to obtain
the solution
y = kx.
This is a general solution, since the original equation was
first order and the solution contains one arbitrary constant.
If an inexact differential has one integrating factor, it
has been shown that it has an infinite number of integrating
factors. Unfortunately, there is no general procedure for
finding an integrating factor except by trial and error.
1/y 2
Exercise 12.14. Show that
is an integrating factor
for the equation in the previous example and show that it
leads to the same solution.
x
Equilibrium position
x=0
x=L
FIGURE 12.6 A flexible string.
2. Its motion is restricted to small vibrations, so that the
string is not appreciably stretched.
3. It has a finite length and both ends of the string are fixed
in position.
Figure 12.6 depicts the string. We use the equilibrium
(straight) position of the string as our x axis and let one end
of the string be at x = 0 and the other end of the string be at
x = L. The displacement of the string from its equilibrium
position in the y direction is denoted by y(x, t) and the
displacement in the z direction is denoted by z(x,t).
The equation of motion of the string is derived by
writing Newton’s second law for a small segment of the
string and taking a mathematical limit as the length of the
segment becomes infinitesimal.5 The motions in the y and z
directions are independent of each other and can be solved
separately. The equation of motion for the y direction is
∂2 y
∂t 2
=
T
ρ
∂2 y
∂x2
= c2
∂2 y
∂x2
,
(12.80)
where T is the magnitude of the tension force on the string
and ρ is the mass of the string per unit length. We let
12.7 PARTIAL DIFFERENTIAL EQUATIONS
c=
T
.
ρ
(12.81)
Differential equations that contain partial derivatives are
called partial differential equations. These equations
involve functions of several independent variables.
12.7.2 Solution by Separation of Variables
12.7.1 Waves in a String
We seek a solution that can be written as a product of factors,
each of which depends on only one variable:
We consider the classical equation of motion of a
ﬂexible string. There are important similarities between
this equation and the Schrödinger equation of quantum
mechanics. The flexible string is a model system designed
to provide an approximate representation of a real string
such as those found in musical instruments. This flexible
string is defined as follows:
1. It is completely flexible, so that no force is required to
bend the string.
y(x,t) = ψ(x)θ (t).
(12.82)
This is called a solution with the variables separated. We
regard it as a trial solution and substitute it into the
differential equation. This method of separation of variables
is slightly different from our previous version, since we are
5 Robert G. Mortimer, Physical Chemistry, 3rd ed., Elsevier, 2008, pp.
1268–1269.
152
Mathematics for Physical Chemistry
now separating two independent variables instead of one
independent variable and one dependent variable.
Since ψ does not depend on t and θ does not depend on
x, the result of substituting the trial solution into Eq. (12.80)
is
d2 ψ
d2 θ
2
=
c
.
(12.83)
θ
(t)
ψ(x)
dt 2
dx 2
We can evaluate the constants to make the solution apply
to a specific case. We have the boundary conditions that
y(0) = 0 and y(L) = 0. If y must vanish at x = 0 and at x = L,
then ψ must vanish at these points, since the factor θ does
not depend on x:
ψ(0) = 0
(12.91)
We write ordinary derivatives since we now have functions
of only one variable. We separate the variables by dividing
both sides of Eq. (12.83 ) by the product ψ(x)θ (t). We also
divide by c2 :
ψ(L) = 0.
1 d2 θ
1 d2 ψ
=
.
2
2
c θ (t) dt
ψ(x) dx 2
(12.84)
We now use the fact that x and t are mathematically
independent variables. If we temporarily keep t fixed at
some value, the left-hand side of Eq. (12.84) is equal to a
constant. We can still allow x to vary, so the right-hand side
of the equation must be a constant function of x. We equate
it to the constant −κ 2 :
1 d2 ψ
= −κ 2 = constant.
ψ(x) dx 2
θ (t) = b1 cos (κct) + b2 sin (κct).
a1 = 0,
(12.93)
since cos (0) = 1 and sin 0 = 0. Since sin 0 = 0,
the condition of Eq. (12.91) is satisfied. Equation (12.92)
requires that
sin (κ L) = 0.
(12.94)
We know that
sin (nπ ) = 0 (n = 0,1,2, . . . ),
(12.95)
where n is some integer. Therefore,
κ=
(12.86)
We denote the constant by the symbol −κ 2 because this
choice will make κ into a real quantity. We now multiply
Eq. (12.85) by ψ(x) and multiply Eq. (12.86) by c2 θ (t).
We obtain
d2 ψ
+ κ 2ψ = 0
(12.87)
dx 2
and
d2 θ
+ κ 2 c2 θ = 0.
(12.88)
dt 2
The separation of variables is complete, and we have two
ordinary differential equations. Except for the symbols
used, both of these equations are the same as Eq. (12.12). We
transcribe the real solution to that equation with appropriate
changes in symbols:
ψ(x) = a1 cos (κ x) + a2 sin (κ x),
(12.92)
Equation (12.91) requires that
(12.85)
For the same reason, the left-hand side must be a constant
function of t, and must equal the same constant:
1 d2 θ
= −κ 2 .
c2 θ (t) dt 2
and
(12.89)
(12.90)
These are general solutions to the ordinary differential
equations of Eqs. (12.87) and (12.88), but we do not
necessarily have a general solution to our partial differential
equation, because there can be solutions that are not of the
form of Eq. (12.82).
nπ
(n = 1,2,3, . . . ).
L
(12.96)
We are not interested in the case that n = 0, because this
corresponds to a stationary string at its equilibrium position.
Negative values of n simply change the sign of the function,
which is irrelevant.
The coordinate factor ψ in our solution is now
ψ(x) = a2 sin
nπ x
.
L
(12.97)
To determine the time-dependent factor θ , we apply initial
conditions. Let us assume that at t = 0, the string is passing
through its equilibrium position, which corresponds to y = 0
for all x. If so, then b1 = 0 since cos (0) = 1. We now have
θ = b2 sin
nπ ct
L
.
The complete solution is
y(x,t) = A sin
nπ x
nπ ct
sin
L
L
,
(12.98)
where we write A = a2 b2 . The maximum amplitude
(maximum value of y) is equal to A, and another initial
condition would be required to specify its value.
We have a set of solutions, one for each value of the
integer n. Figure 12.7 shows the function ψ(x) for several
values of n. Each curve represents the shape of the string
at an instant when θ (t) = 1. At other times, the string
is vibrating between such a position and a position given
CHAPTER | 12 Differential Equations
153
When a string in a musical instrument is struck
or bowed, it will usually not vibrate according to a
single harmonic. The following Fourier series is a linear
combination that satisfies Eq. (12.80) and can represent
any possible motion of the string:
n=5
n=4
∞
y(x,t) =
n=3
sin
n=1
+bn sin
n=2
nπ x
L
an cos
nπ ct
L
nπ ct
L
.
(12.102)
n=1
FIGURE 12.7 Standing waves in a flexible string.
by −ψ(x). There are fixed points at which the string is
stationary. These points are called nodes, and the number
of nodes other than the two nodes at the ends of the string
is equal to n − 1. A wave with stationary nodes is called a
standing wave.
We let λ represent the wavelength, or the distance for
the sine function in ψ to go through a complete period:
nλ = 2L.
(12.99)
The period of oscillation is the time required for the
sine function in the factor θ (t) to go through a complete
oscillation and return the string to its original position and
velocity, which requires the argument of the sine function
to range through 2π . If τ represents the period,
nπ cτ
2L
= 2π ; τ =
.
L
nc
This is a Fourier series in time with coefficients that
depend on position. The fact that a linear combination of
solutions can be a solution to the equation is an example
of the principle of superposition. We can regard the linear
combination as a physical representation of constructive
and destructive interference of the different harmonics.
The strengths of the different harmonics are represented by
the values of the coefficients an and bn . Different musical
instruments have different relative strengths of different
harmonics.
For a string of finite length with fixed ends, only standing
waves can occur. For an infinitely long string, traveling
waves can also occur. In a traveling wave, nodes move along
the string. A traveling wave does not generally correspond
to a solution with the variables separated. The following
wave function represents a traveling wave:
y(x,t) = A sin k(x − ct) .
Example 12.12. Show that the function in Eq. (12.103)
satisfies the wave equation:
(12.100)
The frequency ν is the reciprocal of the period:
ν=
n
nc
=
2L
2L
T
ρ
1/2
.
(12.101)
In musical acoustics, the oscillation corresponding to n = 1
is called the fundamental, that for n = 2 is the ﬁrst overtone,
and so on. The fundamental is also called the ﬁrst harmonic,
the first overtone is called the second harmonic, and
so on.
Exercise 12.15. A certain violin string has a mass per unit
length of 20.00 mg cm−1 and a length of 55.0 cm. Find the
tension force necessary to make it produce a fundamental
tone of A above middle C (440 oscillations per second =
440 s−1 = 440 Hz).
(12.103)
c2
∂2 y
∂t 2
= c2
∂2 y
∂x2
∂2 y
∂t 2
= −A(kc)2 sin k(x − ct) ,
∂2 y
∂x2
= −Ac2 k 2 sin k(x − ct) .
,
We can show that the function of Eq. (12.103) represents
a traveling wave by showing that a node in the wave moves
along the string. When t = 0, there is a node at x = 0. At
a later time, this node is located at a value of x such that
k(x − ct) is still equal to zero. At a time t, x = ct at the node,
so that the speed of the wave is equal to c. Using Eq. (14)
of Appendix B, we can show that
A sin k x − ct
= A sin kx cos (kct) − cos kx sin kct
.
(12.104)
154
Mathematics for Physical Chemistry
This equation exhibits the fact that a traveling wave is
equivalent to the sum of two standing waves that interfere
with each other constructively and destructively.
Exercise 12.16. Find the speed of propagation of a
traveling wave in an infinite string with the same mass per
unit length and the same tension force as the violin string
in the previous exercise.
12.7.3 The Schrödinger Equation
The time-dependent Schrödinger equation for a particle
moving only in the x direction is
2
∂2
+ V (x)
2m ∂ x 2
−
=i
∂
,
∂t
(12.105)
where = h/2π , where h is Planck’s constant, equal to
6.6260755 × 10−34 J s, and where V (x) represents the
potential energy. We separate the variables by assuming
the product wave function
(x,t) = ψ(x)θ (t).
(12.106)
Substitution of this trial solution into the differential
equation gives
−
2
2m
θ (t)
∂ 2ψ
∂θ
+ V (x)θ (t)ψ(x) = i ψ(x) . (12.107)
∂x2
∂t
1 ∂ 2ψ
1 ∂θ
.
+ V (x)ψ(x) = i
2m ψ(x) ∂ x 2
θ (t) ∂t
2
(12.108)
Each side of this equation must be a constant function of
its independent variable, which we denote by E:
∂ 2ψ
2m(E − V∝
= −
ψ,
2
∂x2
iE
∂θ
= − θ.
∂t
(12.109)
(12.110)
Both of these equations are similar to the equation that
we solved for the flexible string. Equation (12.109) can be
rewritten
− 2 ∂ 2ψ
+ V (x)ψ = Eψ.
2m ∂ x 2
12.8 SOLUTION OF DIFFERENTIAL
EQUATIONS USING LAPLACE
TRANSFORMS
Some differential equations can be solved by taking the
Laplace transforms of the terms in the equation, applying
some of the theorems presented in Section 11.3 to obtain
an expression for the Laplace transform of the unknown
function, and then finding the inverse transform. We
illustrate this procedure with the differential equation for
the less than critically damped harmonic oscillator,6 Eq.
(12.43), which can be rewritten
d2 z
dt 2
ζ dz
k
ζ
k
+ z = z (2) + z (1) + z = 0,
m dt
m
m
m
(12.112)
where we use the notation z (2) for the second derivative
d2 z/dt 2 and z (1) for the first derivative dz/dt. We take the
Laplace transforms of the terms this equation, applying Eq.
(11.48) and the n = 2 version of Eq. (11.49), to express
the Laplace transforms of the first and second derivatives.
We let Z(s) be the Laplace transform of z and obtain the
algebraic equation
+
k
ζ
[s Z − z(0)] + Z = 0.
m
m
(12.113)
We solve this equation for Z:
s 2 Z − sz(0) − z (1) (0) +
Division by ψ(x)θ (t) separates the variables:
−
boundary conditions impose conditions such that E can take
on only specific discrete values, and we say that the energy
is quantized.
(12.111)
This is the time-independent Schrödinger equation for
motion in the x direction. It is called an eigenvalue equation,
and the quantity E is called the eigenvalue . This eigenvalue
E is a possible value of the energy. In many cases, the
Z=
sz(0) + z (1) (0) + (ζ /m)z(0)
.
s 2 + (ζ /m)s + k/m
(12.114)
When we find the inverse transform of Z, we will have our
answer. In order to match an expression for a transform
in Table 11.1, we complete the square in the denominator.
(That is, we add a term so that we have a perfect square plus
another term:)
sz(0) + z (1) (0) + (ζ /m)z(0)
s 2 + (ζ /m)s + ζ 2 /4m 2 − ζ 2 /4m 2 + k/m
(12.115)
(1)
z(0)(s + ζ /m) + z (0)
=
.
(12.116)
(s + ζ /2m)2 − ζ 2 /4m 2 + k/m
Z =
6 Erwin Kreyszig, Advanced Engineering Mathematics, 3rd ed.,
pp. 156–157, Wiley, New York, 1972.
CHAPTER | 12 Differential Equations
155
We have also expressed the numerator in terms of the
quantity that is squared in the denominator. We now make
the substitutions,
a=
ζ2
k
k
ζ
and ω2 =
−
− a2,
=
2
2m
m
4m
m
12.9.1 Euler’s Method
Euler’s method is simple to understand and implement, but
it is not very accurate. Consider a differential equation for
a variable x as a function of t that can be schematically
represented by
dx
= f (x,t)
dt
so that Eq. (12.115) can be written
z(0)(s + a)
z (1) (0)
+
(s + a)2 + ω2
(s + a)2 + ω2
z(0)(s + a)
az(0) + z (1) (0)
=
+
. (12.117)
(s + a)2 + ω2
(s + a)2 + ω2
Z =
We assume the case of less than critical damping, so that
ω2 is positive.
From Table 11.1, we have the inverse transforms,
L−1
L−1
s
+ ω2
ω
2
s + ω2
s2
= cos(ωt),
= sin(ωt)
with the initial condition that x(0) = x0 , a known value.
A formal solution can be written
L e
f (t) = F(s + a),
(12.118)
so that
z (1) (0) + az(0)
sin(ωt) e−at .
ω
(12.119)
Except for the symbols used for constants, this agrees with
the solution obtained earlier in the chapter.
z(t) = z(0) cos(ωt) +
Exercise 12.17. Obtain the solution of Eq. (12.112) in the
case of critical damping, using Laplace transforms.
Our discussion of the Laplace transform method for
solving differential equations suffices only to introduce the
method. The book by Kreyszig in the list at the end of the
book is recommended for further study.
12.9 NUMERICAL SOLUTION OF
DIFFERENTIAL EQUATIONS
Many differential equations occur for which no solution
can be obtained with pencil and paper. With the use of
programmable computers, it is now frequently possible to
obtain numerical approximations to the solutions of these
equations to any desired degree of accuracy.
t
x(t ) = x0 +
0
f (x,t)dt.
(12.121)
Like any other formal solution, this cannot be used in
practice, since the variable x in the integrand function
depends on t in some way that we do not yet know.
Euler’s method assumes that if t is small enough, the
integrand function in Eq. (12.121) can be replaced by its
value at the beginning of the integration. We replace t by
the symbol t and write
and from the shifting theorem of Eq. (11.47)
−at
(12.120)
x( t) ≈ x0 +
t
0
f (x0 ,0)dt = x0 + f (x0, 0) t.
(12.122)
A small value of t is chosen, and this process is repeated
until the desired value of t is reached. Let xi be the value
of x obtained after carrying out the process i times, and let
ti equal i t, the value of t after carrying out the process i
times. We write
xi+1 ≈ xi +
t f (xi, ti ).
(12.123)
Euler’s method is analogous to approximating an
integral by the area under a bar graph, except that the height
of each bar is obtained by starting with the approximate
height of the previous bar and using the known slope of the
tangent line.
Example 12.13. The differential equation for a first-order
chemical reaction without back reaction is
dc
= −kc,
dt
where c is the concentration of the single reactant and k is
the rate constant. Set up an Excel spreadsheet to carry out
Euler’s method for this differential equation. Carry out the
calculation for the initial concentration 1.000 mol l−1, k =
1.000 s−1 for a time of 2.000 s and t = 0.100 s.
156
Mathematics for Physical Chemistry
where c is the concentration of the single reactant and k
is the rate constant. Set up an Excel spreadsheet to carry
out Euler’s method for this differential equation. Carry out
✩ the calculation for the initial concentration 1.000 mol l−1 ,
k = 1.000 l mol−1 s−1 for a time of 2.000 s and for t =
0.100 s. Compare your result with the correct answer.
Here are the numbers from the spreadsheet, using:
✬
Time
Concentration
0.0
1
0.1
0.9
0.2
0.81
0.3
0.729
0.4
0.6561
0.5
0.59049
0.6
0.531441
0.7
0.4782969
0.8
0.43046721
0.9
0.387420489
1.0
0.34867844
1.1
0.313810596
1.2
0.282429536
1.3
0.254186583
1.4
0.228767925
1.5
0.205891132
F1 =
1.6
0.185302019
F2 =
1.7
0.166771817
1.8
0.150094635
1.9
0.135085172
2.0
0.121576655
12.9.2 The Runge–Kutta Method
Since Euler’s method is not accurate except for very
small values of t, more sophisticated methods have been
devised. One such widely used method is the Runge–Kutta
method, which is somewhat analogous to using Simpson’s
method for a numerical integration, as discussed in
Chapter 7.7
Consider again the differential equation represented by
dx
= f (x,t).
dt
In the Runge–Kutta method, Eq. (12.123) is replaced by
1
xi+1 ≈ xi + (F1 + 2F2 + 2F3 + F4 ),
6
(12.124)
where
F3 =
F4 =
t f (xi, ti ),
1
F1, ti +
2
1
t f xi + F2, ti +
2
t f xi + F3, ti + t
tf
xi +
(12.125)
t
2
t
2
.
,
(12.126)
,
(12.127)
(12.128)
✫
✪ We do not present the derivation of this method, which is
discussed in the book by Burden and Faires listed at the end
The result of the spreadsheet calculation is
of the book.
There are also other numerical methods for solving
c(2.00 s) ≈ 0.1216 mol l−1
differential equations, which we do not discuss. The
numerical methods can be extended to sets of simultaneous
The correct answer is
differential equations such as those that occur in the analysis
−kt
of chemical reaction mechanisms. Many of these sets of
c(2.00 s) = c(0)e
equations have a property called stiffness that makes them
−1
= (1.000 mol l )
difficult to treat numerically. Techniques have been devised
× exp −(1.000 s−1 ) 2.000 s
to handle this problem, which is beyond the scope of this
book.8
−1
= 0.1353 mol l
Using a value of
calculation is
t = 0.05 s, the result of the spreadsheet
c(2.00 s) ≈ 0.1258 mol l−1
Exercise 12.18. The differential equation for a secondorder chemical reaction without back reaction is
dc
= −kc2 ,
dt
12.9.3 Solution of Differential Equations
with Mathematica
Mathematica can solve differential equations both symbolically and numerically.
7 See the book by Burden, Faires, and Reynolds and the book by Hornbeck
listed at the end of the book.
8 C. J. Aro, Comput. Phvs. Comm. 97, 304 (1996).
CHAPTER | 12 Differential Equations
Symbolic Solution
The statement DSolve is used to carry out a symbolic
solution of a differential equation. We illustrate this with
an example.
Example 12.14. Use Mathematica to solve the differential
equation
dy
= ay(x).
dx
We enter the Mathematica statement
DSolve[y’[x]= =a y[x], y[x], x]
and press the “Enter” key. Notice how the statement is
written inside the brackets. First comes the equation, with
the first derivative denoted by y’. The double equal sign
must be used to let Mathematica know that an equation
is to be solved. We have used a blank space between the
a and the y[x] to indicate multiplication. After a comma
comes the specification of the dependent variable, y[x].
Note the use of brackets, not parentheses. The independent
variable must be included inside the brackets. After another
comma comes the statement of the independent variable.
Mathematica returns the output
Out[1]={{y[x] →
ea x
C[1]}}
Note the space between the a and the x and the space
between the exponential and the constant C[1] in the output.
The constant C[1] is to be determined by initial conditions.
An initial condition can be included in the original input
statement. For example, if y(0) = 2 , we would enter
DSolve[{y’[x]==a y[x],y[0]==2},y[x],x]
and press the “Enter” key or a “Shift-Return.” The output
would be
Out[1]={{y[x] → 2
ea x }}
Numerical Solution
Mathematica carries out numerical solutions of differential
equation for which no exact solution can be written. The
solution is given in terms of an interpolating function,
which is a table of values of the unknown function for
different values of the independent variable. The program
finds a numerical value of the function for a specific value
of the independent variable by interpolation in this table.
The statement NDSolve is used to solve the differential
equation, as in the next example:
Example 12.15. Obtain the numerical solution to the
differential equation
dy
= 2 sin (x)
dx
157
for the interval 0 < x < π with the initial condition
y(0) = 1.
We type the input
NDSolve[{y’[x]==2 sin[x], y[0]==1}, y, {x, 0, Pi}]
and press the “Enter” key. The output appears
Out[1]={{y → InterpolatingFunction[{0,3.141593}, <
>]}}
To obtain the value of the function at some value of x,
say x = 2, we type the input
y[2] /.%1
and press the “Enter” key or a “Shift-return”. The /. is the
replacement operator in Mathematica and is typed as two
characters, a forward slash and a period. The %1 means that
the output line number 1 is referred to. If the interpolating
function had been in line 3, we would have typed %3. The
output result now appears
Out[2]={3.83229}
To obtain a graph of the solution, we enter
Plot[Evaluate[y[x] /. %1], {x, 0, Pi}]
and press the “Enter” key or a “Shift-Return”. The graph
appears as the output.
PROBLEMS
1. An object moves through a fluid in the x direction. The
only force acting on the object is a frictional force that
is proportional to the negative of the velocity:
Fx = −ζ υx = −ζ
dx
dt
.
Write the equation of motion of the object. Find the
general solution to this equation and obtain the particular
solution that applies if x(0) = 0 and vx (0) = v0 =
constant. Construct a graph of the position as a function
of time.
2. A particle moves along the z axis. It is acted upon by a
constant gravitational force equal to −kmg, where k is
the unit vector in the z direction. It is also acted on by a
frictional force given by
F f = −kζ
dz
dt
,
where ζ is a constant called a “friction constant.” Find
the equation of motion and obtain a general solution.
Find z as a function of time if z(0) = 0 and vx (0) = 0.
Draw a graph of z as a function of time.
158
Mathematics for Physical Chemistry
3. An object sliding on a solid surface experiences a
frictional force that is constant and in the opposite
direction to the velocity if the particle is moving, and is
zero it is not moving. Find the position of the particle as
a function of time if it moves only in the x direction and
the initial position is x(0) = 0 and the initial velocity is
vx (0) = v0 = constant. Proceed as though the constant
force were present at all times and then cut the solution
off at the point at which the velocity vanishes. That is,
just say that the particle is fixed after this time. Construct
a graph of x as a function of time for the case that
v0 = 10.00 m s−1 .
4. A harmonic oscillator has a mass m = 0.300 kg and a
force constant k = 155 N m−1 :
(a) Find the period and the frequency of oscillation.
(b) Find the value of the friction constant ζ necessary
to produce critical damping with this oscillator.
Find the value of the constant λ1 .
(c) Construct a graph of the position of the oscillator
as a function of t for the initial conditions
z(0) = 0,vz (0) = 0.100 m s−1 .
5. A less than critically damped harmonic oscillator has a
mass m = 0.3000 kg, a force constant k = 98.00 N m−1 ,
and a friction constant ζ = 1.000 kg s−1 .
concentration in the tank, write and solve the differential
equation that governs the number of moles of solute in
the tank. The inlet pipe allows A moles per hour to flow
in and the overflow pipe allows Bn moles per hour to flow
out, where A and B are constants and n is the number
of moles of solute in the tank. Find the values of A and
B that correspond to a volume in the tank of 100.0 l, an
input of 1.000 l h−1 of a solution with 1.000 mol l−1 ,
and an output of 1.000 l h−1 of the solution in the tank.
Find the concentration in the tank after 5.00 h, if the
initial concentration is zero.
9. An nth-order chemical reaction with one reactant obeys
the differential equation
dc
= −kcn ,
dt
where c is the concentration of the reactant and k is a
constant. Solve this differential equation by separation
of variables. If the initial concentration is c0 moles per
liter, find an expression for the time required for half of
the reactant to react.
10. Find the solution to the differential equation
d2 y
dy
− 2y = −xe x .
−
dx 2
dx
(a) Find the circular frequency of oscillation ω and 11. Test the following equations for exactness and solve the
exact equations:
compare it with the frequency that would occur if
there were no damping.
(a) (x 2 + x y + y 2 )dx + 4x 2 − 2x y + 3y 2 dy = 0.
(b) Find the time required for the real exponential
(b) ye x dx + e x dy = 0.
factor in the solution to drop to one-half of its
(c) 2x y − cos (x) dx + x 2 − 1 dy = 0.
value at t = 0.
6. A forced harmonic oscillator with a circular frequency 12. Use Mathematica to solve the differential equation
symbolically
ω = 6.283 s−1 (frequency ν = 1.000 s−1 ) is exposed
to an external force F0 sin (αt) with circular frequency
dy
+ y cos (x) = e− sin (x) .
α = 7.540 s−1 such that in the solution of Eq. (12.63)
dx
becomes
13. Use Mathematica to obtain a numerical solution to the
z(t) = sin(ωt) + 0.100 sin αt .
differential equation in the previous problem for the
range 0 < x < 10 and for the initial condition y(0) = 1.
Using Excel or Mathematica, make a graph of z(t) for a
Evaluate the interpolating function for several values of
time period of at least 20 s.
x and make a plot of the interpolating function for the
7. A forced harmonic oscillator with mass m = 0.300 kg
range 0 < x < 10.
and a circular frequency ω = 6.283 s−1 (frequency ν =
14.
Solve
the differential equation
1.000 s−1 ) is exposed to an external force F0 exp ( −
βt) sin (αt) with α = 7.540 s−1 and β = 0.500 s−1 .
d2 y
− 4y = 2e3x + sin (x).
Find the solution to its equation of motion. Construct a
dx 2
graph of the motion for several values of F0 .
8. A tank contains a solution that is rapidly stirred, so that 15. Radioactive nuclei decay according to the same
differential equation which governs first-order chemical
it remains uniform at all times. A solution of the same
reactions, Eq. (12.71). In living matter, the isotope 14 C
solute is flowing into the tank at a fixed rate of flow,
is continually replaced as it decays, but it decays without
and an overflow pipe allows solution from the tank to
replacement beginning with the death of the organism.
flow out at the same rate. If the solution flowing in has
The half-life of the isotope (the time required for half of
a fixed concentration that is different from the initial