ApCoCoA-1:Num.NumericalDerivative

From ApCoCoAWiki
Revision as of 10:22, 17 May 2013 by S schuster (talk | contribs) (New page: <command> <title>Num.NumericalDerivative</title> <short_description>Compute numerical derivatives of arbitrarily spaced data using local polynomial regression.</short_description> <synt...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Num.NumericalDerivative

Compute numerical derivatives of arbitrarily spaced data using local polynomial regression.

Syntax

NumericalDerivative(Points: MAT, MaxDiffOrd:INT, Nl:INT, Nr:INT, Deg:INT)

Description

This command computes numerical derivatives of given data series.

Matrix Points is considered to consist of two columns, ie., is considered to be of type Mat([[X_1,Y_1],...,[X_k, Y_k]]).

The polynomial degree Deg must be less than the window size Nl+Nr+1. The derivatives are computed up to order MaxDiffOrd.

The resulting matrix has Nl+Nr rows less than Points and has MaxDiffOrd+1 columns.

  • @param Points The data points for which numerical derivatives are computed.

  • @param MaxDiffOrd The order up to which derivatives are computed.

  • @param Nl Number of left data points to be considered.

  • @param Nr Number of right data points to be considered.

  • @param Deg Maximum degree of the interpolation polynomal. Must be greater or equal MaxOrd.

  • @return A matrix that represents the derivatives of Points up to order MaxDiffOrd.


Example

Points := Mat([[ I^2/800, Fn.CosN(I^2/800, 10) ] | I In 0..40 ]);

MaxDiffOrd := 3;
Nl := 4;
Nr := 4;
Deg := 3;
Mode := 0; -- Mode is currently not used!
StepWidth := 0.5;

Result := Num.NumericalDerivative(Points, MaxDiffOrd, Nl, Nr, Deg);
Dec(Result, 2); 

-- (Result) --
Mat([
  [<quote>0.99</quote>, <quote>0.02</quote>, <quote>0.99</quote>, <quote>0.03</quote>]
  [<quote>0.99</quote>, <quote>0.03</quote>, <quote>0.99</quote>, <quote>0.05</quote>]
[...]

See also

Num.SavGol