Está en la página 1de 7

MATH20401(PDEs) Tony Shardlow Answer Sheet Part IV

1. Multiply the PDE by u, integrate over [0, 1] , and integrate by parts,


_
1
0
u
t
udx =
_
1
0
u
xx
udx
_
1
0
u
2
dx
=
_
u
x
u
_
1
0

_
1
0
u
2
x
dx
_
1
0
u
2
dx
=
_
1
0
u
2
x
dx
_
1
0
u
2
dx
0.
The left hand side equals
1
2
E

(t), as
d
dt
_
1
0
u(x, t)
2
dx = 2
_
1
0
u
t
udx.
We conclude that E(t) is decreasing.
Let u, v and be two solutions and dene w = u v. Then w satsies
w
t
= w
xx
w, w
x
(0, t) = w
x
(1, t) = 0,
and initial condition w(x, 0) = 0. Let
E(t) =
_
1
0
w(x, t)
2
dx.
Then E(0) = 0, E(t) 0 by denition, and E(t) is decreasing by the above argument.
Hence E(t) = 0 for all t. Hence
_
1
0
(u(x, t) v(x, t))
2
dx = 0
Hence u(x, t) = v(x, t) = 0 for all t, x.
2. The explicit Euler method is
X
n+1
= X
n
+f(X
n
)k,
where X
0
is given.
For f(X) = X
2
, the exact solution to dX/dt = f(X) with X(0) = 1 is X(t) = 1/(1 t).
This is found as follows.
_
X
1
_
X
1
=
_
X(t)
X(0)
dX
X
2
=
_
t
0
dt = t
Then 1 X
1
= t and rearranging X(t) = 1/(1 t). At t = 0.2, the solution is
X(0.2) = 1.25
The explicit Euler iteration with k = 0.1 goes X
0
= 1, X
1
= 1 + kf(1) = 1.1, X
2
=
1.1 +kf(1.1) = 1.221.
Hence, the error is |X
2
X(2k)| = |1.2210 1.25| = 0.029.
MATH20401(PDEs): Answer Sheet IV: Page 1
3. (a) If X
0
= 2, k = 0.2, and f(X) = X, the trapezoidal method is
X
n+1
= X
n
+ 0.2(X
n
+X
n+1
)/2 X
0
= 2.
so
0.9X
n+1
= 1.1X
n
, X
n+1
= (11/9)X
n
The approximation to X(1) is given by X
5
= (11/9)
5
X
0
= 5.4548. The exact
solution X(1) = 2e
1
= 5.4366. So the error |X(1) X
5
| = 0.018.
(b) For the linear test equation,
X
n+1
= X
n
+k(X
n
+X
n+1
)/2
so that
(1 k/2)X
n+1
= (1 +k/2)X
n
.
and
X
n+1
= X
n
, =
1 +k/2
1 k/2
Then X
n
0 as n if || < 1. Let denote complex conjugate; then
=
1 +k +k
2
||
2
/4
1 k +k
2
||
2
/4
Now || = ( )
1/2
, so || < 1 if and only if < 1 if and only
1 +k +k
2
||
2
/4 1 k +k
2
||
2
/4.
So || < 1 if and only if k < 0 (the left half of the complex plane). This is
identical to the stability region for the linear test equation.
(c) The trapezoidal method is implicit, because a nonlinear system of equation needs to
be solved to determine X
n+1
(in the general case that f is nonlinear).
4. (a)
u
t
(x, t) =

j=0
u

j
(t) cos(jx)
u
xx
(x, t) =

j=0
j
2

2
u
j
(t) cos(jx)
Hence u
t
= u
xx
u implies that
u

j
= j
2

2
u
j
u
j
.
(b) To nd the initial condition, note
u(x, 0) =

j=0
u
j
(0) cos(jx).
Multiply by cos jx and integrate, exploiting the orthogonality relation,
u
j
(0)
_
1
0
cos
2
(jx) dx =
_
1
0
cos(jx)u
0
(x) dx.
Finally,
u
j
(0) =
_
_
1
0
u
0
(x) dx, j = 0
2
_
1
0
u
0
(x) cos(jx) dx, j > 0
MATH20401(PDEs): Answer Sheet IV: Page 2
(c) The method of lines approximation is to truncate the number of terms in the series
and approximate u(x, t) by
u
J
(x, t) =
J

j=0
u
j
(t) cos(jx).
The coecients u
j
(t) for j = 0, . . . , J are computed numerically by applying the
explicit Euler method to
u

j
= (1 +j
2

2
)u
j
, j = 0, . . . , J.
Notice these equations are decoupled and we may solve each separately. To do this
by the explicit Euler method, we must assume the time step k is chosen so that
k lies in the region of absolute stability. That is, | (1 + j
2

2
)k + 1| < 1; i.e.
k < 2/(1 +j
2

2
) for j = 0, . . . , J . Hence, the time restriction is
k < 2/(1 +J
2

2
).
This is very restrictive as we must take J large to resolve the spatial discretisation.
To avoid a time step restriction, an implicit method should be used like implicit Euler
or the Trapezoidal method for the time stepping. Neither of these methods suers
from the time step restriction and is stable for any choice of J .
The following questions are NOT tested on the nal exam.
5. Using separation of variables, we can nd innitely many solutions to the heat equa-
tion with homogenous Dirichlet boundary conditions: u
n
(x, t) = c
n
exp(n
2

2
t) sin (nx)
where c
n
is an arbitrary constant and n = 1, 2, . . . .
(a) To enforce the initial condition we apply the principle of superposition (or just note
that only the coecients corresponding to n = 1 and n = 3 are non-zero) to obtain
the formal solution u(x, t) = e

2
t
sin (x) +e
9
2
t
sin (3x) .
For the approximation with n = 6 so that x
0
= 0, x
1
=
1
6
, x
2
=
1
3
, x
3
=
1
2
,
x
4
=
2
3
, x
5
=
5
6
, x
6
= 1, we let u
m
j
denote an approximation to the exact value
u(x
j
, t
m
). If we set t
0
= 0 then the explicit nite dierence scheme given in the
lecture notes yields ve equations for the new values u
1
1
, u
1
2
, u
1
3
, u
1
4
, u
1
5
at the new time
level t
1
= k. In general, given old values at time level t
m
, the new values at
time level t
m+1
:= t
m
+k are given by
u
m+1
j
= u
m
j1
+ (1 2) u
m
j
+u
m
j+1
, j = 1 : 5, m = 0, 1, 2, . . .
with =
k
h
2
, and boundary values u
m
0
= u
m
6
= 0.
MATH20401(PDEs): Answer Sheet IV: Page 3
Since h = 1/6, this can be written as a matrix equation
_
_
_
_
_
_
1 72k 36k 0 0 0
36k 1 72k 36k 0 0
0 36k 1 72k 36k 0
0 0 36k 1 72k 36k
0 0 0 36k 1 72k
_
_
_
_
_
_
_
_
_
_
_
_
u
m
1
u
m
2
u
m
3
u
m
4
u
m
5
_
_
_
_
_
_
=
_
_
_
_
_
_
u
m+1
1
u
m+1
2
u
m+1
3
u
m+1
4
u
m+1
5
_
_
_
_
_
_
.
For m = 0 the initial condition gives the values
u
0
1
= sin
_

6
_
+ sin
_

2
_
= 1.5, u
0
2
= sin
_

3
_
+ sin () =

3
2
, u
0
3
= 0,
u
0
4
=

3
2
, u
0
5
= 1.5.
With the time step k = 0.002, we can then compute
u
1
1
= 0.856 (1.5) + 0.072

3
2
= 1.346354
u
1
2
= 0.072 (1.5) + 0.856

3
2
+ 0.072 (0) = 0.849318
u
1
3
= 0.072

3
2
+ 0.856 (0) + 0.072

3
2
= 0.124708
u
1
4
= 0.072 (0) + 0.856

3
2
+ 0.072 (1.5) = 0.849318
u
1
5
= 0.072

3
2
+ 0.856 (1.5) = 1.346354.
The errors at the end points x
0
and x
6
are zero since the numerical solution agrees
with the exact solutions there. At the interior points, we have:
e
1
1
= u
1
1
u(1/6, 0.001) = 1.346354 1.327460 = 0.018894 etc, ...
e
1
2
= 0.000219, e
1
3
= 0.0185137, e
1
4
= 0.000219, e
1
5
= 0.018894.
(b) The truncation error at a point (x
j
, t
m
) is the remainder when the exact solution is
substituted into the dierence scheme:
T
m
j
=
1
k
{u(x
j
, t
m+1
) u(x
j
, t
m
)}
1
h
2
{u(x
j+1
, t
m
) 2u(x
j
, t
m
) +u(x
j1
, t
m
)} .
To determine the consistency error we expand u(x
j
, t
m+1
) , u(x
j+1
, t
m
) and u(x
j1
, t
m
)
about the point (x
j
, t
m
) using Taylor series:
u(x
j
, t
m+1
) = u(x
j
, t
m
) +ku
t
(x
j
, t
m
) +
k
2
2
u
tt
(x
j
, t
m
) +O(k
3
)
u(x
j+1
, t
m
) = u(x
j
, t
m
) +hu
x
(x
j
, t
m
) +
h
2
2
u
xx
(x
j
, t
m
)
+
h
3
6
u
xxx
(x
j
, t
m
) +O(h
4
)
u(x
j1
, t
m
) = u(x
j
, t
m
) hu
x
(x
j
, t
m
) +
h
2
2
u
xx
(x
j
, t
m
)

h
3
6
u
xxx
(x
j
, t
m
) +O(h
4
).
Substituting these expressions into the truncation error and rearranging gives:
T
m
j
= u
t
(x
j
, t
m
) u
xx
(x
j
, t
m
) +
k
2
u
tt
(x
j
, ) +O(h
2
).
MATH20401(PDEs): Answer Sheet IV: Page 4
The sum of the rst two terms is zero (from the denition of the dierential equation).
Taking the modulus and using the triangle inequality then gives

T
m
j

O(k) +O(h
2
).
Finally, writing h
2
=
k

and bounding by the maximum value gives

T
m
j

= O(k).
We deduce that the explicit dierence scheme is rst order consistent.
6. We substitute u
m
j
= a
m
sin(Njh) into
u
m+1
j
u
m
j
= (u
m
j1
2u
m
j
+u
m
j+1
)
The right hand side
(u
m
j1
2u
m
j
+u
m
j+1
) = a
m
_
sin(N(j 1)h) 2 sin(Njh) + 2 sin(N(j + 1)h)
_
.
Recall the trig identity sin(A+B) = cos Asin B + cos Bsin A,
sin(N(j 1)h) 2 sin(Njh) + 2 sin(N(j + 1)h)
=
_
sin(Njh) cos(Nh) + cos(Njh) sin(Nh)
_
2 sin(Njh)
+
_
sin(Njh) cos(Nh) + cos(Njh) sin(Nh)
_
=2
_
cos(Nh) 1
_
sin(Njh).
Then
(a
m+1
a
m
) sin(Njh) = a
m
2(cos(Nh) 2) sin(Njh)
Eliminating the sin term,
a
m+1
=
_
1 + 2
_
cos(Nh) 1
_
_
a
m
For N = n 1, we have (n 1)h = (1/h 1)h 1 as h 0 and then
a
m+1
(1 4)a
m
so a
m
(1 4)
m
a
0
. For a
0
= 0, a
m
as m if (1 4) < 1. For the
numerical solution to be bounded, it is necessary that < 1/2.
7. The truncation error at a point (x
j
, t
m
) is the remainder when the exact solution is
substituted into the dierence scheme:
T
m
j
=
1
k
{u(x
j
, t
m
) u(x
j
, t
m1
)}
1
h
2
{u(x
j+1
, t
m
) 2u(x
j
, t
m
) +u(x
j1
, t
m
)} .
MATH20401(PDEs): Answer Sheet IV: Page 5
To determine the consistency error we expand u(x
j
, t
m1
) , u(x
j+1
, t
m
) and u(x
j1
, t
m
)
about the point (x
j
, t
m
) using Taylor series.
u(x
j
, t
m1
) = u(x
j
, t
m
) ku
t
(x
j
, t
m
) +
k
2
2
u
tt
(x
j
, t
m
) +O(k
3
)
u(x
j+1
, t
m
) = u(x
j
, t
m
) +hu
x
(x
j
, t
m
) +
h
2
2
u
xx
(x
j
, t
m
)
+
h
3
6
u
xxx
(x
j
, t
m
) +O(h
4
)
u(x
j1
, t
m
) = u(x
j
, t
m
) hu
x
(x
j
, t
m
) +
h
2
2
u
xx
(x
j
, t
m
)

h
3
6
u
xxx
(x
j
, t
m
) +O(h
4
)
Substituting these expressions into the truncation error and rearranging gives:
T
m
j
= u
t
(x
j
, t
m
) u
xx
(x
j
, t
m
)
k
2
u
tt
(x
j
, ) +O(h
2
).
The sum of the rst two terms is zero (from the denition of the dierential equation).
Taking the modulus and using the triangle inequality then gives

T
m
j

O(k) +O(h
2
).
Finally, writing h
2
=
k

and bounding by the maximum value gives

T
m
j

= O(k).
We deduce that the implicit dierence scheme is rst order consistent.
8. From the denition of the dierence scheme the truncation error is given by
T
m
j
=
1
2k
{u(x
j
, t
m+1
) u(x
j
, t
m1
)}

1
h
2
{u(x
j+1
, t
m
) u(x
j
, t
m+1
) u(x
j
, t
m1
) +u(x
j1
, t
m
)}
=
1
2k
_

2k
h
2
u(x
j+1
, t
m
) + (1 +
2k
h
2
)u(x
j
, t
m+1
)
(1
2k
h
2
)u(x
j
, t
m1
)
2k
h
2
u(x
j1
, t
m
)
_
.
Thus, expanding the terms u(x
j+1
, t
m
), u(x
j1
, t
m
), u(x
j
, t
m+1
), u(x
j
, t
m1
) about the
point (x
j
, t
m
) using Taylor series gives
T
m
j
=
u
t
(x
j
, t
m
)

2
u
x
2
(x
j
, t
m
) +
k
2
h
2

2
u
t
2
(x
j
, t
m
)
O(h
2
) +O(k
2
).
Now consider the two alternative choices of .
(a) If = k/h then
T
m
j
=
u
t
(x
j
, t
m
)

2
u
x
2
(x
j
, t
m
) +
2

2
u
t
2
(x
j
, t
m
)
+O(k
2
).
MATH20401(PDEs): Answer Sheet IV: Page 6
Letting k 0 we see that the nite diference scheme is consistent with the (hyper-
bolic) PDE:
u
t
+
2

2
u
t
2
=

2
u
x
2
.
Note that, in this case, the nite dierence solution does not converge to the solution
of the heat equation!
(b) If = k/h
2
then
T
m
j
=
u
t
(x
j
, t
m
)

2
u
x
2
(x
j
, t
m
) +k

2
u
t
2
(x
j
, t
m
)
+O(k).
In this case letting k 0, we see that the nite dierence scheme is consistent with
the heat equation.
MATH20401(PDEs): Answer Sheet IV: Page 7

También podría gustarte