10.4 Wave Equation in two Dimensions 323
and att= 0 it reduces to
ut≈
ui,+ 1 −ui,− 1
2 ∆t =^0 ,
implying thatui,+ 1 =ui,− 1. If we insert this condition in Eq. (10.19) we arrive at a special
formula for the first time step
ui, 1 =ui, 0 +
∆t^2
2 ∆x^2
(ui+ 1 , 0 − 2 ui, 0 +ui− 1 , 0 ). (10.20)
We need seemingly two different equations, one for the first time step given by Eq. (10.20)
and one for all other time-steps given by Eq. (10.19). However, it suffices to use Eq. (10.19)
for all times as long as we provideu(i,− 1 )using
ui,− 1 =ui, 0 +∆t
2
2 ∆x^2
(ui+ 1 , 0 − 2 ui, 0 +ui− 1 , 0 ),
in our setup of the initial conditions.
The situation is rather similar for the 2 + 1 -dimensional case, except that we now need to
discretize the spatialy-coordinate as well. Our equations will now depend on three variables
whose discretized versions are now
tl=l∆t l≥ 0
xi=i∆x 0 ≤i≤nx
yj=j∆y 0 ≤j≤ny
,
and we will let∆x=∆y=handnx=nyfor the sake of simplicity. The equation with initial and
boundary conditions reads now
uxx+uyy=utt x,y∈( 0 , 1 ),t> 0
u(x,y, 0 ) =g(x,y) x,y∈( 0 , 1 )
u( 0 , 0 ,t) =u( 1 , 1 ,t) = 0 t> 0
∂u/∂t|t= 0 = 0 x,y∈( 0 , 1 )
.
We have now the following discretized partial derivatives
uxx≈
uli+ 1 ,j− 2 uli,j+uli− 1 ,j
h^2
,
and
uyy≈
uli,j+ 1 − 2 uli,j+uli,j− 1
h^2 ,
and
utt≈
uli+,j^1 − 2 uli,j+uli−,j^1
∆t^2
,
which we merge into the discretized 2 + 1 -dimensional wave equation as
uli+,j^1 = 2 uli,j−uli,−j^1 +
∆t^2
h^2
(
uli+ 1 ,j− 4 uli,j+uli− 1 ,j+uli,j+ 1 +uli,j− 1
)
, (10.21)
where again we have an explicit scheme withuli,+j^1 as the only unknown quantity. It is easy to
account for different step lengths forxandy. The partial derivative is treated in much the
same way as for the one-dimensional case, except that we now have an additional index due
to the extra spatial dimension, viz., we need to computeu−i,^1 jthrough
u−i,^1 j=u^0 i,j+
∆t
2 h^2
(
u^0 i+ 1 ,j− 4 u^0 i,j+u^0 i− 1 ,j+u^0 i,j+ 1 +u^0 i,j− 1