Diffrential Equations
In this post, I'll introduce about Diffrential Equations.
First-order differential
equations
Reference: Boyce and DiPrima, Chapter 2
The general first-order differential equation for the function π¦ = π¦(π₯) is written
as
ππ¦
ππ₯ = π(π₯, π¦), (2.1)
where π(π₯, π¦) can be any function of the independent variable π₯ and the dependent
variable π¦. We first show how to determine a numerical solution of this
equation, and then learn techniques for solving analytically some special forms
of (2.1), namely, separable and linear first-order equations.
2.1 The Euler method
view tutorial
Although it is not always possible to find an analytical solution of (2.1) for
π¦ = π¦(π₯), it is always possible to determine a unique numerical solution given
an initial value π¦(π₯0) = π¦0, and provided π(π₯, π¦) is a well-behaved function.
The differential equation (2.1) gives us the slope π(π₯0, π¦0) of the tangent line
to the solution curve π¦ = π¦(π₯) at the point (π₯0, π¦0). With a small step size
Ξπ₯, the initial condition (π₯0, π¦0) can be marched forward in the x-coordinate
to π₯ = π₯0 + Ξπ₯, and along the tangent line using Eulerβs method to obtain the
y-coordinate
π¦(π₯0 + Ξπ₯) = π¦(π₯0) + Ξπ₯π(π₯0, π¦0).
This solution (π₯0 + Ξπ₯, π¦0 + Ξπ¦) then becomes the new initial condition and is
marched forward in the x-coordinate another Ξπ₯, and along the newly determined
tangent line. For small enough Ξπ₯, the numerical solution converges to
the exact solution.
13
14 CHAPTER 2. FIRST-ORDER ODES
2.2 Separable equations
view tutorial
A first-order ode is separable if it can be written in the form
π(π¦)
ππ¦
ππ₯ = π(π₯), π¦(π₯0) = π¦0, (2.2)
where the function π(π¦) is independent of π₯ and π(π₯) is independent of π¦. Integration
from π₯0 to π₯ results in
β«οΈ π₯
π₯0
π(π¦(π₯))π¦
β²
(π₯)ππ₯ =
β«οΈ π₯
π₯0
π(π₯)ππ₯.
The integral on the left can be transformed by substituting π’ = π¦(π₯), ππ’ =
π¦
β²
(π₯)ππ₯, and changing the lower and upper limits of integration to π¦(π₯0) = π¦0
and π¦(π₯) = π¦. Therefore,
β«οΈ π¦
π¦0
π(π’)ππ’ =
β«οΈ π₯
π₯0
π(π₯)ππ₯,
and since π’ is a dummy variable of integration, we can write this in the equivalent
form
β«οΈ π¦
π¦0
π(π¦)ππ¦ =
β«οΈ π₯
π₯0
π(π₯)ππ₯. (2.3)
A simpler procedure that also yields (2.3) is to treat ππ¦/ππ₯ in (2.2) like a fraction.
Multiplying (2.2) by ππ₯ results in
π(π¦)ππ¦ = π(π₯)ππ₯,
which is a separated equation with all the dependent variables on the left-side,
and all the independent variables on the right-side. Equation (2.3) then results
directly upon integration.
Example: Solve ππ¦
ππ₯ +
1
2
π¦ =
3
2
, with π¦(0) = 2.
We first manipulate the differential equation to the form
ππ¦
ππ₯ =
1
2
(3 β π¦), (2.4)
and then treat ππ¦/ππ₯ as if it was a fraction to separate variables:
ππ¦
3 β π¦
=
1
2
ππ₯.
We integrate the right-side from the initial condition π₯ = 0 to π₯ and the left-side
from the initial condition π¦(0) = 2 to π¦. Accordingly,
β«οΈ π¦
2
ππ¦
3 β π¦
=
1
2
β«οΈ π₯
0
ππ₯. (2.5)
2.2. SEPARABLE EQUATIONS 15
0 1 2 3 4 5 6 7
0
1
2
3
4
5
6
x
y
dy/dx + y/2 = 3/2
Figure 2.1: Solution of the following ode: ππ¦
ππ₯ +
1
2
π¦ =
3
2
.
The integrals in (2.5) need to be done. Note that π¦(π₯) < 3 for finite π₯ or the
integral on the left-side diverges. Therefore, 3 β π¦ > 0 and integration yields
β ln (3 β π¦)
]οΈπ¦
2
=
1
2
π₯
]οΈπ₯
0
,
ln (3 β π¦) = β
1
2
π₯,
3 β π¦ = π
β 1
2
π₯
,
π¦ = 3 β π
β 1
2
π₯
.
Since this is our first nontrivial analytical solution, it is prudent to check our
result. We do this by differentiating our solution:
ππ¦
ππ₯ =
1
2
π
β 1
2
π₯
=
1
2
(3 β π¦);
and checking the initial conditions, π¦(0) = 3 β π
0 = 2. Therefore, our solution
satisfies both the original ode and the initial condition.
Example: Solve ππ¦
ππ₯ +
1
2
π¦ =
3
2
, with π¦(0) = 4.
This is the identical differential equation as before, but with different initial
conditions. We will jump directly to the integration step:
β«οΈ π¦
4
ππ¦
3 β π¦
=
1
2
β«οΈ π₯
0
ππ₯.
16 CHAPTER 2. FIRST-ORDER ODES
Now π¦(π₯) > 3, so that π¦ β 3 > 0 and integration yields
β ln (π¦ β 3)]οΈπ¦
4
=
1
2
π₯
]οΈπ₯
0
,
ln (π¦ β 3) = β
1
2
π₯,
π¦ β 3 = π
β 1
2
π₯
,
π¦ = 3 + π
β 1
2
π₯
.
The solution curves for a range of initial conditions is presented in Fig. 2.1.
All solutions have a horizontal asymptote at π¦ = 3 at which ππ¦/ππ₯ = 0. For
π¦(0) = π¦0, the general solution can be shown to be π¦(π₯) = 3+(π¦0β3) exp(βπ₯/2).
Example: Solve ππ¦
ππ₯ =
2 cos 2π₯
3+2π¦
, with π¦(0) = β1. (i) For what values of
π₯ > 0 does the solution exist? (ii) For what value of π₯ > 0 is π¦(π₯)
maximum?
Notice that the solution of the ode may not exist when π¦ = β3/2, since ππ¦/ππ₯ β
β. We separate variables and integrate from initial conditions:
(3 + 2π¦)ππ¦ = 2 cos 2π₯ ππ₯
β«οΈ π¦
β1
(3 + 2π¦)ππ¦ = 2 β«οΈ π₯
0
cos 2π₯ ππ₯
3π¦ + π¦
2
]οΈπ¦
β1
= sin 2π₯
]οΈπ₯
0
π¦
2 + 3π¦ + 2 β sin 2π₯ = 0
π¦Β± =
1
2
[β3 Β±
β
1 + 4 sin 2π₯].
Solving the quadratic equation for π¦ has introduced a spurious solution that
does not satisfy the initial conditions. We test:
π¦Β±(0) = 1
2
[β3 Β± 1] = {οΈ
-1;
-2.
Only the + root satisfies the initial condition, so that the unique solution to the
ode and initial condition is
π¦ =
1
2
[β3 + β
1 + 4 sin 2π₯]. (2.6)
To determine (i) the values of π₯ > 0 for which the solution exists, we require
1 + 4 sin 2π₯ β₯ 0,
or
sin 2π₯ β₯ β
1
4
. (2.7)
Notice that at π₯ = 0, we have sin 2π₯ = 0; at π₯ = π/4, we have sin 2π₯ = 1;
at π₯ = π/2, we have sin 2π₯ = 0; and at π₯ = 3π/4, we have sin 2π₯ = β1 We
therefore need to determine the value of π₯ such that sin 2π₯ = β1/4, with π₯ in
the range π/2 < π₯ < 3π/4. The solution to the ode will then exist for all π₯
between zero and this value.
2.3. LINEAR EQUATIONS 17
0 0.5 1 1.5
β1.6
β1.4
β1.2
β1
β0.8
β0.6
β0.4
β0.2
0
x
y
(3+2y) dy/dx = 2 cos 2x, y(0) = β1
Figure 2.2: Solution of the following ode: (3 + 2π¦)π¦
β² = 2 cos 2π₯, π¦(0) = β1.
To solve sin 2π₯ = β1/4 for π₯ in the interval π/2 < π₯ < 3π/4, one needs to
recall the definition of arcsin, or sinβ1
, as found on a typical scientific calculator.
The inverse of the function
π(π₯) = sin π₯, βπ/2 β€ π₯ β€ π/2
is denoted by arcsin. The first solution with π₯ > 0 of the equation sin 2π₯ = β1/4
places 2π₯ in the interval (π, 3π/2), so to invert this equation using the arcsine
we need to apply the identity sin (π β π₯) = sin π₯, and rewrite sin 2π₯ = β1/4 as
sin (π β 2π₯) = β1/4. The solution of this equation may then be found by taking
the arcsine, and is
π β 2π₯ = arcsin (β1/4),
or
π₯ =
1
2
(οΈ
π + arcsin
1
4
)οΈ
.
Therefore the solution exists for 0 β€ π₯ β€ (π + arcsin (1/4)) /2 = 1.6971 . . . ,
where we have used a calculator value (computing in radians) to find arcsin(0.25) =
0.2527 . . . . At the value (π₯, π¦) = (1.6971 . . . , β3/2), the solution curve ends and
ππ¦/ππ₯ becomes infinite.
To determine (ii) the value of π₯ at which π¦ = π¦(π₯) is maximum, we examine
(2.6) directly. The value of π¦ will be maximum when sin 2π₯ takes its maximum
value over the interval where the solution exists. This will be when 2π₯ = π/2,
or π₯ = π/4 = 0.7854 . . . .
The graph of π¦ = π¦(π₯) is shown in Fig. 2.2.
2.3 Linear equations
view tutorial
18 CHAPTER 2. FIRST-ORDER ODES
The first-order linear differential equation (linear in π¦ and its derivative) can be
written in the form
ππ¦
ππ₯ + π(π₯)π¦ = π(π₯), (2.8)
with the initial condition π¦(π₯0) = π¦0. Linear first-order equations can be integrated
using an integrating factor π(π₯). We multiply (2.8) by π(π₯),
π(π₯)
[οΈ
ππ¦
ππ₯ + π(π₯)π¦
]οΈ
= π(π₯)π(π₯), (2.9)
and try to determine π(π₯) so that
π(π₯)
[οΈ
ππ¦
ππ₯ + π(π₯)π¦
]οΈ
=
π
ππ₯[π(π₯)π¦]. (2.10)
Equation (2.9) then becomes
π
ππ₯[π(π₯)π¦] = π(π₯)π(π₯). (2.11)
Equation (2.11) is easily integrated using π(π₯0) = π0 and π¦(π₯0) = π¦0:
π(π₯)π¦ β π0π¦0 =
β«οΈ π₯
π₯0
π(π₯)π(π₯)ππ₯,
or
π¦ =
1
π(π₯)
(οΈ
π0π¦0 +
β«οΈ π₯
π₯0
π(π₯)π(π₯)ππ₯)οΈ
. (2.12)
It remains to determine π(π₯) from (2.10). Differentiating and expanding (2.10)
yields
π
ππ¦
ππ₯ + πππ¦ =
ππ
ππ₯π¦ + π
ππ¦
ππ₯;
and upon simplifying,
ππ
ππ₯ = ππ. (2.13)
Equation (2.13) is separable and can be integrated:
β«οΈ π
π0
ππ
π
=
β«οΈ π₯
π₯0
π(π₯)ππ₯,
ln π
π0
=
β«οΈ π₯
π₯0
π(π₯)ππ₯,
π(π₯) = π0 exp (οΈβ«οΈ π₯
π₯0
π(π₯)ππ₯)οΈ
.
Notice that since π0 cancels out of (2.12), it is customary to assign π0 = 1. The
solution to (2.8) satisfying the initial condition π¦(π₯0) = π¦0 is then commonly
written as
π¦ =
1
π(π₯)
(οΈ
π¦0 +
β«οΈ π₯
π₯0
π(π₯)π(π₯)ππ₯)οΈ
,
with
π(π₯) = exp (οΈβ«οΈ π₯
π₯0
π(π₯)ππ₯)οΈ
the integrating factor. This important result finds frequent use in applied mathematics.
2.3. LINEAR EQUATIONS 19
Example: Solve ππ¦
ππ₯ + 2π¦ = π
βπ₯
, with π¦(0) = 3/4.
Note that this equation is not separable. With π(π₯) = 2 and π(π₯) = π
βπ₯
, we
have
π(π₯) = exp (οΈβ«οΈ π₯
0
2ππ₯)οΈ
= π
2π₯
,
and
π¦ = π
β2π₯
(οΈ
3
4
+
β«οΈ π₯
0
π
2π₯
π
βπ₯
ππ₯)οΈ
= π
β2π₯
(οΈ
3
4
+
β«οΈ π₯
0
π
π₯
ππ₯)οΈ
= π
β2π₯
(οΈ
3
4
+ (π
π₯ β 1))οΈ
= π
β2π₯
(οΈ
π
π₯ β
1
4
)οΈ
= π
βπ₯
(οΈ
1 β
1
4
π
βπ₯
)οΈ
.
Example: Solve ππ¦
ππ₯ β 2π₯π¦ = π₯, with π¦(0) = 0.
This equation is separable, and we solve it in two ways. First, using an integrating
factor with π(π₯) = β2π₯ and π(π₯) = π₯:
π(π₯) = exp (οΈ
β2
β«οΈ π₯
0
π₯ππ₯)οΈ
= π
βπ₯
2
,
and
π¦ = π
π₯
2
β«οΈ π₯
0
π₯πβπ₯
2
ππ₯.
The integral can be done by substitution with π’ = π₯
2
, ππ’ = 2π₯ππ₯:
β«οΈ π₯
0
π₯πβπ₯
2
ππ₯ =
1
2
β«οΈ π₯
2
0
π
βπ’
ππ’
= β
1
2
π
βπ’
]οΈπ₯
2
0
=
1
2
(οΈ
1 β π
βπ₯
2
)οΈ
.
Therefore,
π¦ =
1
2
π
π₯
2
(οΈ
1 β π
βπ₯
2
)οΈ
=
1
2
(οΈ
π
π₯
2
β 1
)οΈ
.
20 CHAPTER 2. FIRST-ORDER ODES
Second, we integrate by separating variables:
ππ¦
ππ₯ β 2π₯π¦ = π₯,
ππ¦
ππ₯ = π₯(1 + 2π¦),
β«οΈ π¦
0
ππ¦
1 + 2π¦
=
β«οΈ π₯
0
π₯ππ₯,
1
2
ln (1 + 2π¦) = 1
2
π₯
2
,
1 + 2π¦ = π
π₯
2
,
π¦ =
1
2
(οΈ
π
π₯
2
β 1
)οΈ
.
The results from the two different solution methods are the same, and the choice
of method is a personal preference.
Komentar
Posting Komentar