27.9 EXERCISES
27.21 Write a computer program that would solve, for a range of values ofλ,the
differential equation
dy
dx
=
1
√
x^2 +λy^2
,y(0) = 1,
using a third-order Runge–Kutta scheme. Consider the difficulties that might
arise whenλ<0.
27.22 Use the isocline approach to sketch the family of curves that satisfies the non-
linear first-order differential equation
dy
dx
=
a
√
x^2 +y^2
.
27.23 For some problems, numerical or algebraic experimentation may suggest the
form of the complete solution. Consider the problem of numerically integrating
the first-order wave equation
∂u
∂t
+A
∂u
∂x
=0,
in whichAis a positive constant. A finite difference scheme for this partial
differential equation is
u(p, n+1)−u(p, n)
∆t
+A
u(p, n)−u(p− 1 ,n)
∆x
=0,
wherex=p∆xandt=n∆t,withpany integer andna non-negative integer.
The initial values areu(0,0) = 1 andu(p,0) = 0 forp=0.
(a) Carry the difference equation forward in time for two or three steps and
attempt to identify the pattern of solution. Establish the criterion for the
method to be numerically stable.
(b) Suggest a general form foru(p, n), expressing it in generator function form,
i.e. as ‘u(p, n) is the coefficient ofspin the expansion ofG(n, s)’.
(c) Using your form of solution (or that given in the answers!), obtain an
explicit general expression foru(p, n) and verify it by direct substitution into
the difference equation.
(d) An analytic solution of the original PDE indicates that an initial distur-
bance propagates undistorted. Under what circumstances would the differ-
ence scheme reproduce that behaviour?
27.24 In exercise 27.23 the difference scheme for solving
∂u
∂t
+
∂u
∂x
=0,
in whichAhas been set equal to unity, was one-sided in both space (x)and
time (t). A more accurate procedure (known as the Lax–Wendroff scheme) is
u(p, n+1)−u(p, n)
∆t
+
u(p+1,n)−u(p− 1 ,n)
2∆x
=
∆t
2
[
u(p+1,n)− 2 u(p, n)+u(p− 1 ,n)
(∆x)^2
]
.
(a) Establish the orders of accuracy of the two finite difference approximations
on the LHS of the equation.
(b) Establish the accuracy with which the expression in the brackets approxi-
mates∂^2 u/∂x^2.
(c) Show that the RHS of the equation is such as to make the whole difference
scheme accurate to second order in both space and time.