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