Implementing Crank-Nicolson scheme for 1-D wave equation

303 Views Asked by At

I am trying to implement the Crank-Nicolson scheme directly for the second order wave equation by replacing $E^n$ terms in spatial derivative with $(E^(n-1)+2E^(n)+E^(n+1))/4$. I am sure I have obtained the coefficients correctly as I have checked my answer with the scheme given in the book "The finite Difference Method in Partial differential equations" by A.R. Mitchell and D.F. Griffiths. but the code produces extra wave tails as the wave travels in the cavity. as the time passes some small wave peaks appear at the end of the gaussian waveform which propagates in the cavity and these small waveforms get bigger and bigger gradually. specially after the wave reflects from the walls. Please help me to understand what the problem is.