Derivative transformation

Description

Calculates the derivative of the multidimensional function versus parameter. Uses finite differences method of 4-th order.

Arguments

  1. x — parameter instance.

  2. reldelta — finite difference step h.

Inputs

  1. derivative.y — array of size N.

Outputs

  1. derivative.dy — array of size N.

Implementation

The second order finite difference reads as follows:

D2(h)=f(x+h)f(xh)2h.

The fourth order reads as follows:

dydx=D4(h)=13(4D2(h2)D2(h))==43h(f(x+h2)f(xh2))16h(f(x+h)f(xh)).

for more information see https://en.wikipedia.org/wiki/Finite_difference_coefficient.