# Apply Finite Difference Method to a Wave Equation

According to the book I am reading (Numerical Analysis, 2nd Edition by Timothy Sauer) the discretization of a wave equation of this form:

$$u_{tt} = c^2 u_{xx}$$

With these conditions:

$$u(x, 0) = f(x), \forall x \in [a, b]$$

$$u_t(x, 0) = g(x), \forall x \in [a, b]$$

$$u_t(a, t) = l(t), \forall t \geq 0$$

$$u_t(b, t) = r(t), \forall t \geq 0$$

For the first step is equal to:

$$\vec{w_1} = \frac{1}{2}A\vec{w_o} + \Delta{t} \begin{bmatrix} g(x_1) \\ . \\ . \\ . \\ g(x_m) \end{bmatrix} + \frac{\sigma^2}{2} \begin{bmatrix} w_{0,0} \\ 0 \\ . \\ . \\ . \\ 0 \\ w_{m+1, 0} \end{bmatrix}$$

And for the subsequent steps is equal to:

$$\vec{w_{j+1}} = A \vec{w_j} - \vec{w_{j-1}} + \sigma^2 \begin{bmatrix} l(t_j) \\ 0 \\ . \\ . \\ . \\ 0 \\ r(t_j) \end{bmatrix}$$

Where:

$$\sigma = C \left(\frac{\Delta{t}}{\Delta{x}} \right)^2$$

$$\vec{w_j} = \begin{bmatrix} w_{1,j} \\ w_{2, j} \\ . \\ . \\ . \\ w_{m-1, j} \\ w_{m, j} \end{bmatrix}$$

$$A = \begin{bmatrix} 2 - 2\sigma^2 & \sigma^2 & 0 & \dots & 0 \\ \sigma^2 & 2 - 2\sigma^2 & \sigma^2 & \ddots & \vdots \\ 0 & \sigma^2 & 2 - 2\sigma^2 & \ddots & 0 \\ \vdots & \ddots & \ddots & \ddots & \sigma^2 \\ 0 & \dots & 0 & \sigma^2 & 2-2\sigma^2 \end{bmatrix}$$

The detailed explanation is here (Page 1 Page 2)

Now my question is, how can I deal with a wave equation of this form?

$$u_{tt} = 4 u_{xx}$$

With these conditions:

$$u(x, 0) = 0.1e^{-x^2}, \forall x \in [-10, 10]$$

$$u_t(x, 0) = 0, \forall x \in [-10, 10]$$

$$u(-10, t) = u(10, t)$$

Note that in this problem I don't have the value of $l(t)$ nor $r(t)$, they just tell me that they are equal.

I was thinking to solve $w_{0, j + 1}$ (which would be the border where $x = -10$, ie. $u(-10, t)$) in the equation $8.30$ in the first page of the explanation I put, but for that I would need to know the value of $w_{-1,j}$, which is unknown, I could get and approximation of $w_{-1,j}$ if I knew the value of $u_x(0, t)$, because that way I could apply finite differences for the first derivate and do $\frac{w_{1,j} - w_{-1, j}}{2 \Delta{x}} = u_x(0, j \Delta{t})$ and then get the value of $w_{-1,j}$, but again $u_x(0, t)$ is unknown, any thoughts?

Thanks!

• Your problem seems to be underdetermined. For periodic boundary conditions you have to also constrain derivatives at the boundaries. Normally (for e.g. wave along a thin ring) one imposes equality of derivatives in addition to equality of functions, i.e. $u'(-10,t)=u'(10,t)$. – Ruslan Nov 22 '16 at 15:10