next up previous contents
Next: inner product Up: Tensor operations Previous: running product   Contents

difference $\Delta ^{-},\Delta ^{+}$% WIDTH=110 HEIGHT=34

Computes the nearest neighbour difference along a given direction.

\includegraphics[height=10mm]{images/difference}% WIDTH=48 HEIGHT=45 \includegraphics[height=10mm]{images/differencePlus}% WIDTH=48 HEIGHT=45

These operators can be placed on the canvas in two ways:

The optional argument ($\delta$% WIDTH=14 HEIGHT=25 ) can be used to specify the number of neighbours to skip in computing the differences. For example if your data is monthly and you want to calculate changes per year, you would set $\delta$% WIDTH=14 HEIGHT=25 to 12. The length of the dimension being differenced is reduced by $\delta$% WIDTH=14 HEIGHT=25 in the result.

It comes in two different forms which differ only in how the resultant x-vector is calculated. $\Delta_{i}^{-}=x_{i}-x_{i-\delta}$% WIDTH=225 HEIGHT=34 , and $\Delta_{i}^{+}=x_{i+\delta}-x_{i}$% WIDTH=225 HEIGHT=39 , where $i$% WIDTH=9 HEIGHT=23 refers to the x-vector index.

Where there is more than one dimension to data, the user needs to specify the axis along which the difference operation is calculated.