GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Math::Derivative(3) User Contributed Perl Documentation Math::Derivative(3)

Math::Derivative - Numeric 1st and 2nd order differentiation

    use Math::Derivative qw(:all);

    @dydx = forwarddiff(\@x, \@y);

    @dydx = centraldiff(\@x, \@y);

    @dydx = Derivative1(\@x, \@y);     # A synonym for centraldiff()

    @d2ydx2 = Derivative2(\@x, \@y, $yd0, $ydn);

This Perl package exports functions that numerically approximate first and second order differentiation on vectors of data. The accuracy of the approximation will depend upon the differences between the successive values in the X array.

The functions may be imported by name or by using the tag ":all".

forwarddiff()

    @dydx = forwarddiff(\@x, \@y);

Take the references to two arrays containing the x and y ordinates of the data, and return an array of approximate first derivatives at the given x ordinates, using the forward difference approximation.

The last term is actually formed using a backward difference formula, there being no array item to subtract from at the end of the array. If you want to use derivatives strictly formed from the forward difference formula, use only the values from [0 .. #y-1], e.g.:

    @dydx = (forwarddiff(\@x, \@y))[0 .. $#y-1];

or, more simply,

    @dydx = forwarddiff(\@x, \@y);
    pop @dydx;

centraldiff()

    @dydx = centraldiff(\@x, \@y);

Take the references to two arrays containing the x and y ordinates of the data, and return an array of approximate first derivatives at the given x ordinates.

The algorithm used three data points to calculate the derivative, except at the end points, where by necessity the forward difference algorithm is used instead. If you want to use derivatives strictly formed from the central difference formula, use only the values from [1 .. #y-1], e.g.:

    @dydx = (centraldiff(\@x, \@y))[1 .. $#y-1];

Derivative2()

    @d2ydx2 = Derivative2(\@x, \@y);

or

    @d2ydx2 = Derivative2(\@x, \@y, $yp0, $ypn);

Take references to two arrays containing the x and y ordinates of the data and return an array of approximate second derivatives at the given x ordinates.

You may optionally give values to use as the first derivatives at the start and end points of the data. If you don't, first derivative values will be assumed to be zero.

Derivative1()

A synonym for centraldiff().

<http://www.holoborodko.com/pavel/numerical-methods/numerical-derivative/central-differences/>

<http://www.robots.ox.ac.uk/~sjrob/Teaching/EngComp/ecl6.pdf>

John A.R. Williams J.A.R.Williams@aston.ac.uk

John M. Gamble jgamble@cpan.org (current maintainer)

2017-08-16 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.