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


Manual Reference Pages  -  MATH::SPLINE (3)

.ds Aq ’

NAME



    Math::Spline  - Cubic Spline Interpolation of data



CONTENTS

SYNOPSIS



    use Math::Spline;
    $spline = Math::Spline->new(\@x,\@y)
    $y_interp=$spline->evaluate($x);

    use Math::Spline qw(spline linsearch binsearch);
    use Math::Derivative qw(Derivative2);
    @y2=Derivative2(\@x,\@y);
    $index=binsearch(\@x,$x);
    $index=linsearch(\@x,$x,$index);
    $y_interp=spline(\@x,\@y,\@y2,$index,$x);



DESCRIPTION

This package provides cubic spline interpolation of numeric data. The data is passed as references to two arrays containing the x and y ordinates. It may be used as an exporter of the numerical functions or, more easily as a class module.

The <B>Math::SplineB> class constructor <B>newB> takes references to the arrays of x and y ordinates of the data. An interpolation is performed using the <B>evaluateB> method, which, when given an x ordinate returns the interpolate y ordinate at that value.

The <B>splineB> function takes as arguments references to the x and y ordinate array, a reference to the 2nd derivatives (calculated using <B>Derivative2B>, the low index of the interval in which to interpolate and the x ordinate in that interval. Returned is the interpolated y ordinate. Two functions are provided to look up the appropriate index in the array of x data. For random calls <B>binsearchB> can be used - give a reference to the x ordinates and the x loopup value it returns the low index of the interval in the data in which the value lies. Where the lookups are strictly in ascending sequence (e.g. if interpolating to produce a higher resolution data set to draw a curve) the <B>linsearchB> function may more efficiently be used. It performs like <B>binsearchB>, but requires a third argument being the previous index value, which is incremented if necessary.

NOTE

requires Math::Derivative module

EXAMPLE



    require Math::Spline;
    my @x=(1,3,8,10);
    my @y=(1,2,3,4);                                               
    $spline = Math::Spline->new(\@x,\@y);
    print $spline->evaluate(5)."\n";



produces the output

2.44

HISTORY

$Log: Spline.pm,v $ Revision 1.1 1995/12/26 17:28:17 willijar Initial revision

BUGS

Bug reports or constructive comments are welcome.

AUTHOR

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

SEE ALSO

Numerical Recipies: The Art of Scientific Computing W.H. Press, B.P. Flannery, S.A. Teukolsky, W.T. Vetterling. Cambridge University Press. ISBN 0 521 30811 9.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SPLINE (3) 2013-05-16

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