Homework 7
Rhein Ferdous
MATH 316
March 19, 2025
Problem 1. We are given a nonhomogenous differential equation with homogenous Dirich-
let boundary conditions:
ut = kuxx + F (x, t) for 0 < x < L, t > 0 (1)
u(0, t) = 0, u(L, t) = 0 for t > 0 (2)
u(x, 0) = f (x) for 0 ≤ x ≤ L. (3)
If F (x, t) ≡ 0, then we know that a solution would be of the form
∞
X nπx n2 π 2
bn sin ekλn t , λn = − , (4)
n=1
L L2
in which the bn are the coefficients in the Fourier sine expansion of f on [0, L]. For this
nonhomogeneous problem we will attempt a solution
∞
X nπx
u(x, t) = Tn (t) sin (5)
n=1
L
Assume for each t ≥ 0, F (x, t), as a function of x can also be expanded in a Fourier sine
series:
∞
X nπx
F (x, t) = Bn (t) sin (6)
n=1
L
where
Z L
2 nπξ
Bn (t) = F (ξ, t) sin dξ (7)
L 0 L
1
We will solve the PDE satisfied by Tn (t) for all n = 1, 2, 3, ....
Differentiate (5) with respect to t to obtain
∞
X dTn (t) nπx
ut (x, t) = sin (8)
n=1
dt L
and twice with respect to x to obtain
∞
X d2 nπx
uxx (x, t) = Tn (t) sin (9)
n=1
dt2 L
X∞ nπx
= λn Tn (t) sin (10)
n=1
L
Plugging these expressions and (5) into the PDE (1), we arrive at
∞
X dTn (t) nπx
− kλn Tn (t) − Bn (t) sin =0 (11)
n=1
dt L
nπx
Using the orthogonality of the functions {sin L
}, we obtain an infinite sequence of
ODEs:
dTn (t)
− kλn Tn (t) = Bn (t), n = 1, 2, 3, ... (12)
dt
These first order linear ODEs can be solved by multiplying both sides by the integrating
factor
e−kλn t (13)
Which give
d −kλn t
Tn (t) = e−kλn t Bn (t)
e (14)
dt
Integrate both sides from t = 0 to t to obtain
Z t−kλn t
−kλn t
e Tn (t) − Tn (0) = Bn (t)dt (15)
0
Thus,
2
Z t
Tn (t) = e kλnt
bn + e kλnt
e−kλn t Bn (t)dt (16)
0
where bn = Tn (0), and so from (5) we obtain
∞
X nπx ∞ Z
X t nπx
kλn t kλn t
u(x, t) = bn e sin + e Bn (t)dt sin (17)
n=1
L n=1 0 L
3
Problem 2. We solve the nonhomogeneous heat equation numerically:
ut = 4uxx + t2 cos(x/2), 0 < x < π, t > 0, (18)
u(0, t) = u(π, t) = 0, (19)
(
0, 0 ≤ x ≤ π/2
u(x, 0) = (20)
25, π/2 < π
We assume that F (x, t) has a Fourier sine expansion:
∞
X nπx
F (x, t) = Bn (t) sin , (21)
n=1
L
where the Fourier coefficients are given by
Z L
2 nπξ
Bn (t) = F (ξ, t) sin dξ. (22)
L 0 L
Similarly, we expand u(x, t):
∞
X nπx
u(x, t) = Tn (t) sin . (23)
n=1
L
Substituting into the PDE and using orthogonality, we obtain an ODE for each Tn (t):
dTn n2 π 2
− kλn Tn = Bn (t), λn = − . (24)
dt L2
This has the solution:
Z t
Tn (t) = e kλn t
bn + e kλn t
e−kλn s Bn (s)ds, (25)
0
where bn are the Fourier coefficients of f (x):
Z L
2 nπξ
bn = f (ξ) sin dξ. (26)
L 0 L
Solution. Using numerical integration, we computed the first few Fourier coefficients:
b1 = 0.40528, b2 = 0.00000, b3 = −0.04503, b4 = 0.00000, b5 = 0.01621.
4
For the forcing function at t = 0:
B1 (0) = 1.00000, B2 (0) = 0.00000, B3 (0) = 0.00000, B4 (0) = −0.00000, B5 (0) = −0.00000.
The first few Fourier coefficients bn are:
b1 = 0.40528
b2 = 0.00000
b3 = −0.04503
b4 = −0.00000
b5 = 0.01621
The numerical values of Tn (t) for n = 1 to n = 5 are summarized below:
T1 (t) = [0.405, 0.428, 0.449, 0.468, 0.484, 0.498, 0.510, 0.521, 0.530, 0.537]
T2 (t) = [0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
T3 (t) = [−0.045, −0.031, −0.022, −0.015, −0.011, −0.007, −0.005, −0.004, −0.002, −0.002]
T4 (t) = [0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]
T5 (t) = [0.016, 0.006, 0.002, 0.001, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000]