1INTERP(3) User Contributed Perl Documentation INTERP(3)
2
3
4
6 PDL::GSL::INTERP - PDL interface to Interpolation routines in GSL
7
9 This is an interface to the interpolation package present in the GNU
10 Scientific Library.
11
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
27 init()
28 The init method initializes a new instance of INTERP. It needs as input
29 an interpolation type and two piddles holding the x and y values to be
30 interpolated. The GSL routines require that x be monotonically
31 increasing and a quicksort is performed by default to ensure that. You
32 can skip the quicksort by passing the option {Sort => 0}.
33
34 The available interpolation types are :
35
36 linear
37 polynomial
38 cspline (natural cubic spline)
39 cspline_periodic (periodic cubic spline)
40 akima (natural akima spline)
41 akima_periodic (periodic akima spline)
42
43 Please check the GSL documentation for more information.
44
45 Usage:
46
47 $blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
48
49 Example:
50
51 $x = sequence(10);
52 $y = exp($x);
53
54 $spl = PDL::GSL::INTERP->init('cspline',$x,$y)
55 $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
56
57 # no sorting done on x, user is certain that x is monotonically increasing
58 $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
59
60 eval()
61 The function eval returns the interpolating function at a given point.
62 By default it will barf if you try to extrapolate, to comply silently
63 if the point to be evaluated is out of range pass the option
64 {Extrapolate => 1}
65
66 Usage:
67
68 $result = $spl->eval($points,$opt);
69
70 Example:
71
72 my $res = $spl->eval($x)
73 $res = $spl->eval($x,{Extrapolate => 0}) #same as above
74
75 # silently comply if $x is out of range
76 $res = $spl->eval($x,{Extrapolate => 1})
77
78 deriv()
79 The deriv function returns the derivative of the interpolating function
80 at a given point. By default it will barf if you try to extrapolate, to
81 comply silently if the point to be evaluated is out of range pass the
82 option {Extrapolate => 1}
83
84 Usage:
85
86 $result = $spl->deriv($points,$opt);
87
88 Example:
89
90 my $res = $spl->deriv($x)
91 $res = $spl->deriv($x,{Extrapolate => 0}) #same as above
92
93 # silently comply if $x is out of range
94 $res = $spl->deriv($x,{Extrapolate => 1})
95
96 deriv2()
97 The deriv2 function returns the second derivative of the interpolating
98 function at a given point. By default it will barf if you try to
99 extrapolate, to comply silently if the point to be evaluated is out of
100 range pass the option {Extrapolate => 1}
101
102 Usage:
103
104 $result = $spl->deriv2($points,$opt);
105
106 Example:
107
108 my $res = $spl->deriv2($x)
109 $res = $spl->deriv2($x,{Extrapolate => 0}) #same as above
110
111 # silently comply if $x is out of range
112 $res = $spl->deriv2($x,{Extrapolate => 1})
113
114 integ()
115 The integ function returns the integral of the interpolating function
116 between two points. By default it will barf if you try to extrapolate,
117 to comply silently if one of the integration limits is out of range
118 pass the option {Extrapolate => 1}
119
120 Usage:
121
122 $result = $spl->integ($a,$b,$opt);
123
124 Example:
125
126 my $res = $spl->integ($a,$b)
127 $res = $spl->integ($a,$b,{Extrapolate => 0}) #same as above
128
129 # silently comply if $a or $b are out of range
130 $res = $spl->eval($a,$b,{Extrapolate => 1})
131
133 Feedback is welcome.
134
136 PDL
137
138 The GSL documentation is online at
139
140 http://www.gnu.org/software/gsl/manual/
141
143 This file copyright (C) 2003 Andres Jordan
144 <andresj@physics.rutgers.edu> All rights reserved. There is no
145 warranty. You are allowed to redistribute this software/documentation
146 under certain conditions. For details, see the file COPYING in the PDL
147 distribution. If this file is separated from the PDL distribution, the
148 copyright notice should be included in the file.
149
150 The GSL interpolation module was written by Gerard Jungman.
151
152
153
154perl v5.28.0 2018-07-23 INTERP(3)