7.3 Wave Equation 409
valid fori= 1 , 2 ,...,n−1. Naturally, the boundary conditions, Eq. (2), carry
over asu 0 (m)=0,un(m)=0. It is obvious that Eq. (4) requires us to know the
approximate solution at time levelsmandm−1inordertofinditattimelevel
m+1. In other words, to getui( 1 )we needui− 1 ( 0 ),ui( 0 ),ui+ 1 ( 0 )—whichare
available from the initial condition — and alsoui(− 1 )!Ofcourse,wehavenot
yet applied the second initial condition,
∂u
∂t(x,^0 )=g(x),^0 <x<^1.
If we replace the time derivative by a central difference approximation, this
equation translates into
ui( 1 )−ui(− 1 )
2 t =g(xi) (5)
fori= 1 , 2 ,...,n−1. Equation (5), together with a slightly modified version
of Eq. (4) (withm=0andui( 0 )=f(xi)), yields the system
ui( 1 )+ui(− 1 )=ρ^2 f(xi− 1 )+ 2
(
1 −ρ^2
)
f(xi)+ρ^2 f(xi+ 1 ),
ui( 1 )−ui(− 1 )= 2 tg(xi), (6)
which we can easily solve for theu’s at the first time level:
ui( 1 )=^12 ρ^2 f(xi− 1 )+
(
1 −ρ^2
)
f(xi)+^12 ρ^2 f(xi+ 1 )+ tg(xi). (7)
Thus,inordertosolvetheprobleminEqs.(1)–(3)numerically,weusethe
initial condition,ui( 0 )=f(xi), to fill the first line of our table, use thestarting
equation(7) to fill the next line, and continue with therunning equation(4) to
fill subsequent lines.
Example.
Let us now attempt to solve a simple problem. Suppose thatg(x)≡0 for 0<
x<1andthatf(x)is given by
f(x)=
{
2 x, 0 <x<^12 ,
2 ( 1 −x),^12 <x<1. (8)
Also, we shall choosen=4andρ=1 for convenience. (That is, t= x=
1 / 4 .) Our rule for calculation, Eq. (4), is then
ui(m+ 1 )=ui− 1 (m)+ui+ 1 (m)−ui(m− 1 ). (9)
In Table 6 are the calculated values ofui(m). Entries in italics are given data.
It is easy to check that this numerical solution is identical with the d’Alembert
solution of this particular problem. (See Exercise 6.) However, if the initial