# Discrete derivatives with finite-differences

1. May 4, 2010

### mnb96

Hello,
I have a function in discrete domain $$f:\mathbb{Z}\rightarrow \mathbb{R}$$, and I assume that f is an approximation of another differentiable function $$g:\mathbb{R}\rightarrow \mathbb{R}$$.
In other words $$f(n)=g(n)$$, $$n\in \mathbb{Z}$$.

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:

$$\Delta f(n)=f(n+1)-f(n)$$
$$\nabla f(n)=f(n)-f(n-1)$$

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

$$g'(x) \approx \Delta f(x)$$ for $$x\geq 0$$
$$g'(x) \approx \nabla f(x)$$ for $$x<0$$

2. May 4, 2010

### HallsofIvy

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.

3. May 4, 2010

### mnb96

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:

$$g'(x)=-g'(-x)$$, for $$x\in \mathbb{R}$$

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

$$\Delta f(n) = -\nabla f(-n)$$, $n\in \mathbb{Z}^+ - \{ 0 \}$

EDIT: in simpler words g is an even function and its first derivative is an odd function. The discretized f is even too, but $\Delta f$ is not odd.

Last edited: May 4, 2010
4. May 4, 2010

### Martin Rattigan

You could presumably use $\frac{1}{2}(\Delta f+\nabla f)=(f(n+1)-f(n-1))/2$, 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
5. May 5, 2010

### mnb96

Thanks Martin,
yours is probably a better idea. In fact, the central-difference operator keeps the property "f is even $\Rightarrow$ f' is odd".