Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.04 KB

vector.forwarddifferencematrix.md

File metadata and controls

43 lines (25 loc) · 1.04 KB

Home > @josh-brown/vector > forwardDifferenceMatrix

forwardDifferenceMatrix() function

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

Signature:

export declare function forwardDifferenceMatrix(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 forward difference matrix

Remarks

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

Example

forwardDifferenceMatrix(4);

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