# Finite Differences: Which of the following schemes numerically approximates the solution?

• ### d

• Total voters
1

#### ale749

I've got the following PDE:

$u_{tt}(x,t) = \pi u_{xx}(x,t) \quad x \in [0,1], t > 0 \\ u(x,0) = 18sin(3\pi x) \quad \forall x \in [0,1]\\ u_{t}(x,0) = sin(\pi x) \quad \forall x \in [0,1]\\ u(0,t) = u(1,t)=0 \quad \forall t > 0$

Which of the following schemes can numerically approximate the solution?

a) $u_{k+1,j} = r^2(u_{k,j+1} + u_{k, j-1}) + 2(1-r^2) u_{k,j} - u_{k-1,j}$

b) $u_{k,j+1} = r^2(u_{k+1,j} + u_{k-1, j}) + 2(1-r^2) u_{k,j} - u_{k,j-1}$

c) $u_{k+1,j} = r(u_{k,j+1} + u_{k, j-1}) + 2(1-r) u_{k,j} - u_{k-1,j}$

b) $u_{k,j+1} = r(u_{k+1,j} + u_{k-1, j}) + 2(1-r) u_{k,j} - u_{k,j-1}$

Notes: $\Delta x = 1/N; r = \sqrt{\pi} \Delta t / \Delta x ; k = 1,2,...,N-1 ; j = 2,...$

Can anyone not only show me the answer but also explain me a little bit? Or at least provide me some useful links with examples of similar exercises.

I'm also asked if the equation is parabolic and if it is a Laplace equation. I answered false to both of them because I consider the equation to be hiperbolic.

#### romsek

Math Team
• ale749

#### DarnItJimImAnEngineer

The first line of the PDE problem statement is the actual equation. The next three are boundary/initial conditions, which have nothing to do with the scheme in the majority of the $(x,t)$ grid, so we can ignore them for this problem.

In all four cases, we can see that we have $(k-1, k, k+1)$ and $(j-1, j, j+1)$ subscripts, so they appear to be using 2nd-order, central difference approximations for both the time and space derivatives.
$\displaystyle u_{tt} \approx \frac{u_{j+1}-2u_j+u_{j-1}}{\Delta t^2}$

$\displaystyle u_{xx} \approx \frac{u_{k+1}-2u_k+u_{k-1}}{\Delta x^2}$

Now, plug these approximations into $u_{tt} = \pi u_{xx}$, rearrange, and see which of the four options it corresponds to.

(Incidentally, the notation is potentially a little ambiguous. I had to look at the ranges of $j$ and $k$ to be sure they were using the $j$ index for time and the $k$ index for space.)

• ale749 and romsek

#### ale749

The first line of the PDE problem statement is the actual equation. The next three are boundary/initial conditions, which have nothing to do with the scheme in the majority of the $(x,t)$ grid, so we can ignore them for this problem.

In all four cases, we can see that we have $(k-1, k, k+1)$ and $(j-1, j, j+1)$ subscripts, so they appear to be using 2nd-order, central difference approximations for both the time and space derivatives.
$\displaystyle u_{tt} \approx \frac{u_{j+1}-2u_j+u_{j-1}}{\Delta t^2}$

$\displaystyle u_{xx} \approx \frac{u_{k+1}-2u_k+u_{k-1}}{\Delta x^2}$

Now, plug these approximations into $u_{tt} = \pi u_{xx}$, rearrange, and see which of the four options it corresponds to.

(Incidentally, the notation is potentially a little ambiguous. I had to look at the ranges of $j$ and $k$ to be sure they were using the $j$ index for time and the $k$ index for space.)
So I got
$\frac{u_{j+1}-2u_j+u_{j-1}}{\Delta t^2} = \pi \frac{u_{k+1}-2u_k+u_{k-1}}{\Delta x^2}$

How do I get u in terms of j and k?

#### DarnItJimImAnEngineer

Sorry, I was a bit lazy on the notation. Where the space index is not given, I mean it to be $k$. Where the time index is not given, I mean it to be $j$.
Thus $\displaystyle u_{tt} = \frac{u_{k,j+1}-2u_{k,j}+u_{k,j-1}}{\Delta t^2}$.

• ale749

#### ale749

Sorry, I was a bit lazy on the notation. Where the space index is not given, I mean it to be $k$. Where the time index is not given, I mean it to be $j$.
Thus $\displaystyle u_{tt} = \frac{u_{k,j+1}-2u_{k,j}+u_{k,j-1}}{\Delta t^2}$.
Thank you very much! I just solved it, answer seems to be B.

How did you realize $j$ was for time and $k$ for space just from the ranges?

#### DarnItJimImAnEngineer

The ODE was applied at $k=1, 2, …, N-1$. This is consistent with being internal nodes, if we take $k=0$ and $k=N$ to be $x=0$ and $x=1$ (where the boundary conditions are specified).
Meanwhile, $j=2, 3, …$ can correspond to $t>\Delta t$, while $j = 0 \leftrightarrow t = 0$ and $j=1 \leftrightarrow t = \Delta t$ have to be solved separately to satisfy the initial conditions (Dirichlet and Neumann).

• ale749