SYNOPSIS
use Math::Derivative qw(Derivative1 Derivative2);
@dydx = Derivative1(\@x, \@y);
@d2ydx2 = Derivative2(\@x, \@y);
@d2ydx2 = Derivative2(\@x, \@y, $yp0, $ypn);
DESCRIPTION
This Perl package exports functions for performing numerical first (Derivative1) and second Derivative2) order differentiation on vectors of data.FUNCTIONS
The functions must be imported by name.Derivative1()
Take the references to two arrays containing the x and y ordinates of the data, and return an array of the 1st derivative at the given x ordinates.
Derivative2()
Take references to two arrays containing the x and y ordinates of the data and return an array of the 2nd derivative at the given x ordinates.
You may optionally give values to use as the first dervivatives at the start and end points of the data. If you don't, first derivative values will be calculated from the arrays for you.