Home > @josh-brown/vector > backwardDifferenceMatrix
Builds a matrix that transforms a vector to a vector of backward differences
Signature:
export declare function backwardDifferenceMatrix(binCount: number): NumberMatrix;
Parameter | Type | Description |
---|---|---|
binCount | number | The size of the vector to which the output ought to be applied |
Returns:
The backward difference matrix
A backward difference matrix calculates an approximate derivative scaled by the difference when applied to a vector of function values, using a backward difference _f(x) - f(x - delta)_
backwardDifferenceMatrix(4);
// [ 1 0 0 0 ]
// [ -1 1 0 0 ]
// [ 0 -1 1 0 ]
// [ 0 0 -1 1 ]