I am having trouble with this question, much appreciated if anyone can help?
a) for the 2nd order wave equation:
\begin{align} &\partial_{tt}u(x,t)-c^2\partial_{xx}u(x,t)=0 & (x,t) \in (0,1) \text{x}(0,T)\\ &u(x,0)=u_0(x) &(x,t) \in (0,1) \text{x} \{0\}\\ &\partial_tu(x,0)=v_0(x) &(x,t) \in(0,1) \text{x} \{0\} \\ &u(0,t) = u(1,t)=0 & t \in (0,T) \\ \end{align} construct an explicit finite difference method of order 2 in both spatial and temporal components.
b)for the same problem construct an implicit method of order 2 in both spatial and temporal components.
c)when are the above implicit and explicit discretisations stable?
i know this is a lot to ask but i would be very grateful for any help
Use a Finite-Difference, Time Domain scheme, which uses centered time and space differences. You can scale your grid such that $c=1$. I will illustrate for an explicit scheme only. Here,
$$u_i^n = u(i \Delta x,n \Delta t)$$
where
$$u_i^{n+1} = r^2 (u_{i+1}^n -2u_{i}^n + u_{i-1}^n) +2 u_i^n - u_i^{n-1}$$ $$u_i^{n+1} = r^2 (u_{i+1}^n + u_{i-1}^n) +2(1-r^2) u_i^n - u_i^{n-1}$$
where $r = \Delta t/\Delta x$ is the propagation equation for $i \in \{0,1,\ldots,I-1,I\}$ and $n \in \{0,1,\ldots,N-1,N\}$. You also need your boundary conditions.
$$u_0^n = u_I^n = 0$$
for all $n$, and initial conditions
$$u_i^0 = u_0(i \Delta x)$$
$$u_i^1 = u_i^0 + v_0(i \Delta x) \Delta t$$
This scheme is stable so long as $r \le 1$.