Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finite differencing on non-uniform grids

  1. Oct 20, 2015 #1

    hunt_mat

    User Avatar
    Homework Helper

    Hi,

    Recently I had to find a derivative on a uniform grid. Being naive I tried the following scheme:
    [tex]f'(x_{n})=Af(x_{n+2})+Bf(x_{n+1})+Cf(x_{n})+Df(x_{n-1})+Ef(x_{n-2})[/tex]

    Then write the [itex]f(x_{n\pm i})[/itex] in terms of [itex]f^{(n)}(x_{n})[/itex] by use of Taylor's theorem. This lead to a system of linear equations for the A,B,C,D,E which required inverting a Vandermonde matrix.

    I tried it out a couple of times and it worked okay for the first derivative but when I applied it to higher derivatives it became unstable. Does anyone know what is going wrong?

    I also tried a seven point stencil in the same way and that bizarrely was even worse.

    Mat
     
  2. jcsd
  3. Oct 20, 2015 #2

    Geofleur

    User Avatar
    Science Advisor
    Gold Member

    It might be helpful to look at the actual matrix you get for a case that causes trouble. It's probably also a good idea to do this for the smallest system possible. If you can see the problem play out on a system you could compute by hand, it might well give you an idea about what's going wrong.
     
  4. Oct 20, 2015 #3

    hunt_mat

    User Avatar
    Homework Helper

    Possibly, but I have tested the 7 point stencil on simple examples and have not got the answers which I should have. The five point stencil however works relative well for first order derivatives but not on higher derivatives (I think)
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook