Escolar Documentos
Profissional Documentos
Cultura Documentos
DIFFERENTIAL EQUATIONS
Basic Definitions
Ordinary or Partial
Order
Linear or Nonlinear
Solution:
Exact or Approximate
Analytical or Numerical
Definitions
With an equation such as
y = 3x
3
dx2
dx
A dierential equation is called ordinary if it only contains derivatives involving the dierentiation of a function with respect to
a single independent variable. Otherwise, the equation is called
a partial dierential equation. Abbreviations commonly used
are ODE and PDE.
Examples of ODEs and PDEs
Newtons second law can be written in the form of an ordinary
dierential equation in terms of velocity as:
dv F
=
dt m
or, in terms of displacement, as
d2x F
=
dt2
m
The equation representing simple harmonic motion is
dx
d2x
m 2 + c + kx = 0
dt
dt
which is an ODE for the displacement x with respect to time t.
y = 2x + k
where the constant k (the intercept) has a dierent value for each
of the lines. The above solution is thus called a general solution.
To obtain a unique solution, adequate conditions have to be specified. For instance, if we impose that y = 0 when x = 0, then the
only solution satisfying this condition is y = 2x. This solution
is called a particular solution. If all conditions are specified
at the same value of the independent variable, then the problem is called an initial-value problem. In contrast, problems
where specification of conditions occurs at dierent values of the
independent variable are called boundary-value problems.
Example 2
The second-order dierential equation:
dy
d2y
3
+ 2y = 0
dt2
dt
has the general solution
y = Aet + Be2t
Solution:
If
y = Aet + Be2t
then
dy
= Aet + 2Be2t
dt
and
d2y
= Aet + 4Be2t
2
dt
Substituting in the original ODE gives:
5 = Ae0 + 2Be0 = A + 2B
y = et + 2e2t
Linearity
A dierential equation is said to be linear if
dy = 2xdx
The above equation has been separated into terms which are only
dy =
2xdx
y = x2 + c
Solution:
dy
= dx
4y
Integrating both sides gives:
ln y = 4x + c
Example 4
Solve the nonlinear dierential equation:
dy
= 4x
dx
Solution:
ydy = 4xdx
y = Aex + 5
y = Aex
y = yc + yp
Example 5
Solve the non-homogeneous dierential equation:
dy
+ 2y = 4x
dx
Solution:
The corresponding homogeneous equation is
dy
+ 2y = 0
dx
whose solution can be found by separation of variables to be
ln y = 2x + c
or
y = Ce2x
with C = ec. This is the expression of the complementary function yc.
B + 2(A + Bx) = 4x
Hence, equating coecients of x gives B = 2 and equating constant terms gives B + 2A = 0, and so A = 1. Therefore
yp = 1 + 2x
The solution to the non-homogeneous equation is then of the
form
y = Ce2x 1 + 2x
Runge-Kutta Methods
The Euler and Heun methods are versions of one-step approaches
called Runge-Kutta methods, i.e. techniques of the general form
where the as are constants and the ks are functions of the form:
k1 = f (xi, yi)
...
(1)
yi+1
h2 0
f (xi, yi)
= yi + h f (xi, yi) +
2
f 0(xi, yi) =
f f dy
+
x y dx
yi+1
h2 f f dy
+
= yi + h f (xi, yi) +
2 x y dx
(2)
g(x + r, y + s) = g(x, y) + r
g
g
+ s + ...
x
y
f
f
+ q11k1h
+ O(h2)
x
y
f
+
x
f
+ O(h3)
y
f
+ a2q11f (xi, yi) + O(h3)
x
y
f
h2 a2p1
(3)
a1 + a2 = 1
a2p1 =
1
2
a2q11 =
1
2
a1 = 1 a2
p1 = q11 =
1
2a2
The two most commonly used second-order Runge-Kutta methods are the Heun method and the Ralston method. The first is
obtained making a2 = 1/2, for which a1 = 1/2, p1 = q11 = 1,
producing the equation
yi+1
1
1
= yi + h k1 + k2
2
2
with
k1 = f (xi, yi)
k2 = f (xi + h, yi + hk1)
as previously studied.
Ralstons method is obtained when a2 = 2/3, in which case
a1 = 1/3, p1 = q11 = 3/4:
yi+1
2
1
= yi + h k1 + k2
3
3
with
k1 = f (xi, yi)
3
3
k2 = f xi + h, yi + hk1
4
4
Example
Solve the equation
dy
= 2x3 + 12x2 20x + 8.5
dx
with the initial condition y = 1 at x = 0, using Ralstons method
with a step length h = 0.5.
Solution
f (x, y) = 2x3 + 12x2 20x + 8.5
2
1
y(0.5) = y(0) + 0.5 k1 + k2
3
3
k1 = f (0, 1) = 8.5
3
3
k2 = f 0 + 0.5, 1 + 0.5 8.5
4
4
2
1
y(0.5) = 1 + 0.5 8.5 + 2.582
3
3
y(0.5) = 3.277
3
3
k2 = f 0.5 + 0.5, 3.277 + 0.5 1.25
4
4
2
1
y(1.0) = 3.277 + 0.5 1.25 + (1.1523)
3
3
y(1.0) = 3.101
yi+1
1
= yi + h (k1 + 2k2 + 2k3 + k4)
6
where
k1 = f (xi, yi)
1
1
k2 = f xi + h, yi + hk1
2
2
1
1
k3 = f xi + h, yi + hk2
2
2
k4 = f (xi + h, yi + hk3)
Example
Solve the previous problem using the classical fourth-order RK
method with a step length h = 0.5.
Solution
f (x, y) = 2x3 + 12x2 20x + 8.5
1
y(0.5) = y(0) + 0.5 (k1 + 2k2 + 2k3 + k4)
6
k1 = f (0, 1) = 8.5
1
1
k2 = f 0 + 0.5, 1 + 0.5 8.5
2
2
1
1
k3 = f 0 + 0.5, 1 + 0.5 4.21875
2
2
1
y(0.5) = 1 + 0.5 (8.5 + 2 4.21875 + 2 4.21875 + 1.25)
6
y(0.5) = 3.21875
which is the exact value. This was expected because the true
solution is quartic in this case, thus the fourth-order method is
able to predict the exact solution.
Systems of Equations
All methods for single equations can be extended to the solution
of systems of equations. The procedure simply involves applying
the one-step technique for every equation at each step before
proceeding to the next step.
Example
Solve the following system of first-order dierential equations
using Euler method, assuming that at x = 0, y1 = 4 and y2 = 6.
Use a step length of 0.5.
dy1
= 0.5y1
dx
dy2
= 4 0.3y2 0.1y1
dx
Solution
The equations for application of Eulers method are:
xi+1 = xi + h yi
yi+1 = yi + h (xi + 8 cos ti)
Therefore:
x(0.1) = 0 + 0.1 0 = 0
Example
Solve again the equation for the mass-spring system using the
classical fourth-order Runge-Kutta method.
Solution
The equations for application of the classical fourth-order RK
method are of the form:
dx
= f1(t, x, y) = y
dt
xi+1
1
= xi + h (k1,1 + 2k2,1 + 2k3,1 + k4,1)
6
dy
= f2(t, x, y) = x + 8 cos t
dt
yi+1
1
= yi + h (k1,2 + 2k2,2 + 2k3,2 + k4,2)
6
k1,1 = f1(0, 0, 0) = 0
k1,2 = f2(0, 0, 0) = 8
xi +
yi +
1
1
h k1,1 = 0 + 0.1 0 = 0
2
2
1
1
h k1,2 = 0 + 0.1 8 = 0.4
2
2
xi +
yi +
1
1
h k2,1 = 0 + 0.1 0.4 = 0.02
2
2
1
1
h k2,2 = 0 + 0.1 7.990 = 0.3995
2
2
1
x(0.1) = 0 + 0.1 (0 + 2 0.4 + 2 0.3995 + 0.7970)
6
x(0.1) = 0.040
1
y(0.1) = 0 + 0.1 (8 + 2 7.990 + 2 7.970 + 7.920)
6
y(0.1) = 0.797