Next: , Previous: , Up: Internal Routines   [Contents][Index]

15.5.135 differ

differ(x [, axis, order] [, /central])

Returns the running difference of x: each element of the result contains the difference between the corresponding element of x and its |order|-th predecessor. The predecessors of the first elements are taken to be zero. If axis is not specified (or negative), then x is treated as a 1d array. Otherwise, differencing is done along the indicated axis (dimension), and is started over for each of the other dimensions. If order is positive, then the unavailable (first) values of each result vector are set to zero; if negative, then the value from the original is copied (i.e. reverse of runsum). The default order is 1. The /central keyword indicates that central differencing is performed, i.e. the differences are put in the middle of the range instead of at the end. For central differencing, the border values are always set to zero.

Both axis and order may contain multiple elements, in which case a differencing pass is performed for each of the elements, taken the next available element from both. If order has only one element but axis has more than one, then the same value of order is used during each pass. Otherwise, both arguments must contain zero, one, or equal numbers of elements.

Reverse: runsum