1INTERP(3)             User Contributed Perl Documentation            INTERP(3)
2
3
4

NAME

6       PDL::GSL::INTERP - PDL interface to Interpolation routines in GSL
7

DESCRIPTION

9       This is an interface to the interpolation package present in the GNU
10       Scientific Library.
11

SYNOPSIS

13          use PDL;
14          use PDL::GSL::INTERP;
15
16          my $x = sequence(10);
17          my $y = exp($x);
18
19          my $spl = PDL::GSL::INTERP->init('cspline',$x,$y);
20
21          my $res = $spl->eval(4.35);
22          $res = $spl->deriv(4.35);
23          $res = $spl->deriv2(4.35);
24          $res = $spl->integ(2.1,7.4);
25

NOMENCLATURE

27       Throughout this documentation we strive to use the same variables that
28       are present in the original GSL documentation (see See Also).
29       Oftentimes those variables are called "a" and "b". Since good Perl
30       coding practices discourage the use of Perl variables $a and $b, here
31       we refer to Parameters "a" and "b" as $pa and $pb, respectively, and
32       Limits (of domain or integration) as $la and $lb.
33

FUNCTIONS

35   init()
36       The init method initializes a new instance of INTERP. It needs as input
37       an interpolation type and two piddles holding the x and y values to be
38       interpolated. The GSL routines require that x be monotonically
39       increasing and a quicksort is performed by default to ensure that. You
40       can skip the quicksort by passing the option {Sort => 0}.
41
42       The available interpolation types are :
43
44       linear
45       polynomial
46       cspline (natural cubic spline)
47       cspline_periodic  (periodic cubic spline)
48       akima (natural akima spline)
49       akima_periodic  (periodic akima spline)
50
51       Please check the GSL documentation for more information.
52
53       Usage:
54
55           $blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
56
57       Example:
58
59           $x = sequence(10);
60           $y = exp($x);
61
62           $spl = PDL::GSL::INTERP->init('cspline',$x,$y)
63           $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
64
65           # no sorting done on x, user is certain that x is monotonically increasing
66           $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
67
68   eval()
69       The function eval returns the interpolating function at a given point.
70       By default it will barf if you try to extrapolate, to comply silently
71       if the point to be evaluated is out of range pass the option
72       {Extrapolate => 1}
73
74       Usage:
75
76           $result = $spl->eval($points,$opt);
77
78       Example:
79
80           my $res = $spl->eval($x)
81           $res = $spl->eval($x,{Extrapolate => 0}) #same as above
82
83           # silently comply if $x is out of range
84           $res = $spl->eval($x,{Extrapolate => 1})
85
86   deriv()
87       The deriv function returns the derivative of the interpolating function
88       at a given point. By default it will barf if you try to extrapolate, to
89       comply silently if the point to be evaluated is out of range pass the
90       option {Extrapolate => 1}
91
92       Usage:
93
94           $result = $spl->deriv($points,$opt);
95
96       Example:
97
98           my $res = $spl->deriv($x)
99           $res = $spl->deriv($x,{Extrapolate => 0}) #same as above
100
101           # silently comply if $x is out of range
102           $res = $spl->deriv($x,{Extrapolate => 1})
103
104   deriv2()
105       The deriv2 function returns the second derivative of the interpolating
106       function at a given point. By default it will barf if you try to
107       extrapolate, to comply silently if the point to be evaluated is out of
108       range pass the option {Extrapolate => 1}
109
110       Usage:
111
112           $result = $spl->deriv2($points,$opt);
113
114       Example:
115
116           my $res = $spl->deriv2($x)
117           $res = $spl->deriv2($x,{Extrapolate => 0}) #same as above
118
119           # silently comply if $x is out of range
120           $res = $spl->deriv2($x,{Extrapolate => 1})
121
122   integ()
123       The integ function returns the integral of the interpolating function
124       between two points.  By default it will barf if you try to extrapolate,
125       to comply silently if one of the integration limits is out of range
126       pass the option {Extrapolate => 1}
127
128       Usage:
129
130           $result = $spl->integ($la,$lb,$opt);
131
132       Example:
133
134           my $res = $spl->integ($la,$lb)
135           $res = $spl->integ($x,$y,{Extrapolate => 0}) #same as above
136
137           # silently comply if $la or $lb are out of range
138           $res = $spl->eval($la,$lb,{Extrapolate => 1})
139

BUGS

141       Feedback is welcome.
142

SEE ALSO

144       PDL
145
146       The GSL documentation for interpolation is online at
147       <https://www.gnu.org/software/gsl/doc/html/interp.html>
148

AUTHOR

150       This file copyright (C) 2003 Andres Jordan
151       <andresj@physics.rutgers.edu> All rights reserved. There is no
152       warranty. You are allowed to redistribute this software/documentation
153       under certain conditions. For details, see the file COPYING in the PDL
154       distribution. If this file is separated from the PDL distribution, the
155       copyright notice should be included in the file.
156
157       The GSL interpolation module was written by Gerard Jungman.
158
159
160
161perl v5.30.2                      2020-04-02                         INTERP(3)
Impressum