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::INTERPOLATE (3)

.ds Aq ’

NAME

Math::Interpolate - Interpolate the value Y from X using a list of (X, Y) pairs

CONTENTS

SYNOPSIS



 use Math::Interpolate qw(derivatives constant_interpolate
                          linear_interpolate robust_interpolate);
 my @x = (1..5);
 my @y = (5, 10, 13, -4.5, 3);
 my @dy = derivatives(\@x, \@y);
 my ($l_y, $l_dy) = linear_interpolate(3.4, \@x, \@y);
 my ($r_y, $r_dy) = robust_interpolate(3.4, \@x, \@y);
 ($r_y, $r_dy) = robust_interpolate(3.4, \@x, \@y, [-2, 3, 4, -1, 4]);



DESCRIPTION

SUBROUTINES

<B>derivativesB> x_sequence y_sequence Given a reference to an array of x values in x_sequence and a reference to an array of y values in y_sequence, return an array of reasonable derivatives. The x_sequence values are presumed to be sorted in increasing numerical order.

If there is an error in the input, such as x_sequence and y_sequence containing a different number of elements, then the subroutine returns an empty list in list context, an undefined value in scalar context, or nothing in a void context.

<B>constant_interpolateB> x x_sequence y_sequence Given a reference to an array of x values in x_sequence and a reference to an array of y values in y_sequence, return the y value associated with the first x value less than or equal to x. In other words, if
x_sequence->[i] <= x < x_sequence->[i+1]

then return
y_sequence->[i]

If x is less than x_sequence->[0], then return y_sequence->[0]. If x is greater than x_sequence-[-1], then return y_sequence->[-1].

If there is an error in the input, such as x_sequence and y_sequence containing a different number of elements, then the subroutine returns an empty list in list context, an undefined value in scalar context, or nothing in a void context.

<B>linear_interpolateB> x x_sequence y_sequence Given a reference to an array of x values in x_sequence and a reference to an array of y values in y_sequence, calculate the interpolated value y that corresponds to the value x. The returned value y lies on the straight line between the two points surrounding x. If <x> lies outside of the range of values spanned by x_sequence then a linear extrapolation will be done.

In an array context, linear_interpolate will return an array containing the y value and and slope between the two nearest surrounding points.

If there is an error in the input, such as x_sequence and y_sequence containing a different number of elements, then the subroutine returns an empty list in list context, an undefined value in scalar context, or nothing in a void context.

<B>robust_interpolateB> value x_sequence y_sequence [dy_sequence] Given a reference to an array of x values in x_sequence and a reference to an array of y values in y_sequence, calculate the interpolated value y that corresponds to the value x. The interpolated curve generated by robust_interpolate is smooth and even the derivatives of the curve are smooth with only a few exceptions.

The returned value y lies on the curve between the two points surrounding x. If <x> lies outside of the range of values spanned by x_sequence then a linear extrapolation will be done.

In an array context, linear_interpolate will return an array containing the y value and and slope between the two nearest surrounding points.

If there is an error in the input, such as x_sequence and y_sequence containing a different number of elements, then the subroutine returns an empty list in list context, an undefined value in scalar context, or nothing in a void context.

AUTHOR

Blair Zajac <blair@orcaware.com>.

COPYRIGHT

Copyright (C) 1998-2005 Blair Zajac. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 354: =back doesn’t take any parameters, but you said =back 4
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MATH::INTERPOLATE (3) 2013-11-10

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