1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Discrete derivatives with finite-differences

  1. May 4, 2010 #1
    I have a function in discrete domain [tex]f:\mathbb{Z}\rightarrow \mathbb{R}[/tex], and I assume that f is an approximation of another differentiable function [tex]g:\mathbb{R}\rightarrow \mathbb{R}[/tex].
    In other words [tex]f(n)=g(n)[/tex], [tex]n\in \mathbb{Z}[/tex].

    When one wants to approximate the first derivative of g, it is possible to use the forward difference or backward difference operators, which are respecively:

    [tex]\Delta f(n)=f(n+1)-f(n)[/tex]
    [tex]\nabla f(n)=f(n)-f(n-1)[/tex]

    My question is: is it common or allowed to use a mixture of these two operators in the following way:

    [tex]g'(x) \approx \Delta f(x)[/tex] for [tex]x\geq 0[/tex]
    [tex]g'(x) \approx \nabla f(x)[/tex] for [tex]x<0[/tex]
  2. jcsd
  3. May 4, 2010 #2


    User Avatar
    Science Advisor

    No, it is not "common" and I can see no reason to do that. Why would you use one for positive x and the other for negative x? It is the change that is positive or negative in the two differences and whether x is positive or negative has nothing to do with that.
  4. May 4, 2010 #3
    I would like to use different operators for positive/negative x's in order to obtain a symmetry I need. In fact, in my case the continous function g has the property:

    [tex]g'(x)=-g'(-x)[/tex], for [tex]x\in \mathbb{R}[/tex]

    If f(n)=g(n), [itex]n\in \mathbb{Z}[/itex], you get [tex]\Delta f(n) \neq -\Delta f(-n)[/tex].
    Instead, given g I was able to obtain:

    [tex]\Delta f(n) = -\nabla f(-n)[/tex], [itex]n\in \mathbb{Z}^+ - \{ 0 \}[/itex]

    EDIT: in simpler words g is an even function and its first derivative is an odd function. The discretized f is even too, but [itex]\Delta f[/itex] is not odd.
    Last edited: May 4, 2010
  5. May 4, 2010 #4
    You could presumably use [itex]\frac{1}{2}(\Delta f+\nabla f)=(f(n+1)-f(n-1))/2[/itex], but that may be too much arithmetic (the shift operation is usually quite quick if you're doing it by computer).
    Last edited: May 4, 2010
  6. May 5, 2010 #5
    Thanks Martin,
    yours is probably a better idea. In fact, the central-difference operator keeps the property "f is even [itex]\Rightarrow[/itex] f' is odd".
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook