I am attempting to code a problem for a meteorology class. Our initial equation was as follows:
$$\tfrac{\partial u}{\partial t} = \nu \tfrac{\partial^2 u}{\partial x^2} (*)$$
We were then assigned this finite differencing to program:
$$\tfrac{\zeta_{j}^{n+1}-\zeta_{j}^{n-1}} {2\Delta t} = \nu \tfrac{\zeta_{j+1}^{n}-\zeta_{j}^{n+1}-\zeta_{j}^{n-1}+\zeta_{j-1}^{n}}{\Delta x^{2}} (\&)$$
n and j denote time and space respectively.
The problem reads as follows: "Graph (for t = 10000s) one wavelength of the discrete solutions for k=2 [i.e., interval: -$\pi /4$, 3$\pi /4$] and k=4 [i.e., interval: -$\pi /8$, 3$\pi /8$] assuming $\zeta_{0}^{n}=0,\zeta_{j}^{n}=0,\zeta_{j}^{1}=\zeta_{j}^{0}$ for j = 1,......,nx-1, and $\Delta x = L/(nx-1)$, where $L=2\pi /k$. Use $\Delta t = 10s, 1000s, 2000s$, and $5000s.$ How does your analytic solution from solving (*) above compare to the discrete solution a t = 10000s add the analytic solution for t = 10000s to your graph)? Note that there should be two graphs with 5 curves here! What happens to your discrete solution as $\Delta t$ increases?"
I have never seen such a differencing as in the RHS of (&). The LHS is clearly central differencing, yet the right hand side is something I unfamiliar with. It is clearly not forward space, central space, or back space. I am supposed to somehow rearrange (&) to solve for $\zeta_{j}^{n+1}$ and then program the above problem. I do not see how I am supposed to do this, either mathematically or analytically as I do not know of any such differencing methods, and I have spent over 6 hours trying to answer this question.
My apologies if this belongs in the coding forum as I was uncertain whether to post this in math or coding. I am completely unaware of any ways to simultaneously go through two different loops in code, and I have never seen this kind of differencing that combines time and space.

I will give some pointers on how to solve the system numerically.
For simplicity set $\alpha = \left(\frac{\Delta x^2}{2\nu\Delta t}\right)$ and then solve the equation for $\zeta^{n+1}_j$ to find
$$\zeta_{j}^{n+1} = \frac{\zeta_{j+1}^{n}+\zeta_{j-1}^{n}}{1+\alpha} + \frac{\alpha-1}{\alpha + 1}\zeta_{j}^{n-1}$$
This equation tells us that if we know, for any fixed $n$, $\zeta_j^n$ and $\zeta_j^{n-1}$ for all $j$ then the equation above can be used to calculate $\zeta_{j}^{n+1}$ for all $j$.
A simple way to codes this up (there are better memory-saving ways to do this, but this should be good enough here) is to first make an array $\zeta[0:n_t,0:n_x]$ where $n_t$ is the number of time-steps and $n_x$ is the number of grid-cells.
Next we need to input the initial condition $\zeta^1_j = \zeta^0_j = \ldots$ in the entries $\zeta[0,0:n_x]$ and $\zeta[1,0:n_x]$.
Finally we need to propagate the equation to get the solution at all times. This can be best explained by the following pseudo-code
After this is done you have the solution $\zeta(t,x)$ at the points $(t,x) = \left(n\Delta t, x_{\rm min} + \frac{(x_{\rm max}-x_{\rm min})j}{n_x}\right)$ stored in $\zeta[n,j]$.
Another thing to keep in mind when solving is that a stability analysis give that the numerical scheme is only stable if $\alpha \geq 1$. So if you get nonsensical solutions then I would check if this condition is satisfied for your choice of $\Delta x$, $\Delta t$.