I am solving the simple 2nd-order wave equation:(adsbygoogle = window.adsbygoogle || []).push({});

$$ \frac {\partial ^2 E}{\partial t^2} = c^2 \frac {\partial ^2 E}{\partial z^2} $$

Over a domain of (in SI units):

## z = [0,L=10]##m, ##t = [0,t_{max} = 10]##s

and boundary/initial conditions:

$$ E(z=0) = E(z=L) = 0 $$

$$ E(t=0) = -E(t=t_{max}) = sin(\frac{\pi z}{L}) $$

I know the analytic solution, but am trying to solve it numerically. (The numerical and analytic solutions are compared to test accuracy.) I just had a couple questions:

1) When I solve the wave equation by applying a central difference approximation of order 2 on the second derivative of time, the code works perfectly fine. Although when I apply http://(https://en.wikipedia.org/wiki/Finite_difference_coefficient#Forward_and_backward_finite_difference) [Broken] of higher orders for the second derivative in time, my solution diverges. Is there any particular reason why using a backward difference approximation would be worse than a central difference approximation of the same order? I was under the impression using a higher order backward difference method would give me higher accuracy, but it appears to not work at all. I can supply the code if needed, although it's a fairly basic implementation.

2) I am able to solve the equation above when using a central difference approximation and setting ## c = 1## m/s, but if I use ##c = 3 \times 10^8## m/s, the solution diverges. This makes sense as the Courant number (##C_o = c \frac {\Delta t}{\Delta x}##) is much greater than one. But I am curious: are there any possible finite difference schemes that can be applied to numerically solve the equation if ##C_o >> 1##? I have read a bit about BDF methods to help solve stiff equations, but in this case, the only problem is that a more precise grid is needed, correct? I had also heard about spectral methods, but am still trying to learn how to implement them and if they would be applicable/accurate enough if other (nonlinear) terms were included in the wave equation.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Python Using backward vs central finite difference approximation

Have something to add?

Draft saved
Draft deleted

Loading...

Similar Threads - Using backward central | Date |
---|---|

Python Interesting article how to use Pandas with Excel sheets | Feb 19, 2018 |

Need some advice on an appropriate computer language to use | Feb 13, 2018 |

Using MATLAB outside of the lab | Jan 4, 2018 |

Python Good books to learn machine learning using Python | Nov 26, 2017 |

Error: attempt to move .org backwards | Sep 22, 2009 |

**Physics Forums - The Fusion of Science and Community**