Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.05 KB

vector.backwarddifferencematrix.md

File metadata and controls

43 lines (25 loc) · 1.05 KB

Home > @josh-brown/vector > backwardDifferenceMatrix

backwardDifferenceMatrix() function

Builds a matrix that transforms a vector to a vector of backward differences

Signature:

export declare function backwardDifferenceMatrix(binCount: number): NumberMatrix;

Parameters

Parameter Type Description
binCount number The size of the vector to which the output ought to be applied

Returns:

NumberMatrix

The backward difference matrix

Remarks

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)_

Example

backwardDifferenceMatrix(4);

// [  1  0  0  0 ]
// [ -1  1  0  0 ]
// [  0 -1  1  0 ]
// [  0  0 -1  1 ]