# Problem with calculating derivatives

```
I'm having problems trying to get Ferret to compute some vertical
derivatives. I'm getting some odd results that I cannot fathom.

I have a grid, called 'ngh'. I define a variable like this:

let zz=z[g=ngh]-z[g=ngh]+k
list/k=1:4 zz
Z[G=NGH]-Z[G=NGH]+K
330    /  1:   1.00000
358    /  2:   2.00000
388.4  /  3:   3.00000
421.3  /  4:   4.00000

I want to compute the vertical derivative of this so I do:

list/k=1:4 zz[z=@ddc]
Z[G=NGH]-Z[G=NGH]+K
centered derivative on Z
330    /  1:      ....
358    /  2:  1.349215
388.4  /  3:  1.243527
421.3  /  4:  1.146478

I can't see where on earth Ferret gets these numbers from. A centred
derivative ought to be (and the manual says this too):
( zz(k+1) - zz(k-1) ) / ( z(k+1) - z(k-1) )

For k=2 that ought to be :   ( 3 - 1 ) / ( 388.4 - 330 ) = 0.00342 ???

I have no idea where Ferret gets 1.349215 from. What's going on??

Thanks
Glenn

----
Dr. Glenn Carver, Senior Research Associate,
Centre for Atmospheric Science, Chemistry Dept., Cambridge University, UK
mailto:Glenn.Carver@atm.ch.cam.ac.uk   http://www.atm.ch.cam.ac.uk/~glenn/

"I never think of the future, it comes soon enough"
- Albert Einstein

```