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
29 The init method initializes a new instance of INTERP. It needs as input
30 an interpolation type and two piddles holding the x and y values to be
31 interpolated. The GSL routines require that x be monotonically increas‐
32 ing and a quicksort is performed by default to ensure that. You can
33 skip the quicksort by passing the option {Sort => 0}.
34
35 The available interpolation types are :
36
37 · linear
38
39 · polynomial
40
41 · cspline (natural cubic spline)
42
43 · cspline_periodic (periodic cubic spline)
44
45 · akima (natural akima spline)
46
47 · akima_periodic (periodic akima spline)
48
49 Please check the GSL documentation for more information.
50
51 Usage:
52
53 $blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
54
55 Example:
56
57 $x = sequence(10);
58 $y = exp($x);
59
60 $spl = PDL::GSL::INTERP->init('cspline',$x,$y)
61 $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
62
63 # no sorting done on x, user is certain that x is monotonically increasing
64 $spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
65
66 eval()
67
68 The function eval returns the interpolating function at a given point.
69 By default it will barf if you try to extrapolate, to comply silently
70 if the point to be evaluated is out of range pass the option {Extrapo‐
71 late => 1}
72
73 Usage:
74
75 $result = $spl->eval($points,$opt);
76
77 Example:
78
79 my $res = $spl->eval($x)
80 $res = $spl->eval($x,{Extrapolate => 0}) #same as above
81
82 # silently comply if $x is out of range
83 $res = $spl->eval($x,{Extrapolate => 1})
84
85 deriv()
86
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
106 The deriv2 function returns the second derivative of the interpolating
107 function at a given point. By default it will barf if you try to
108 extrapolate, to comply silently if the point to be evaluated is out of
109 range pass the option {Extrapolate => 1}
110
111 Usage:
112
113 $result = $spl->deriv2($points,$opt);
114
115 Example:
116
117 my $res = $spl->deriv2($x)
118 $res = $spl->deriv2($x,{Extrapolate => 0}) #same as above
119
120 # silently comply if $x is out of range
121 $res = $spl->deriv2($x,{Extrapolate => 1})
122
123 integ()
124
125 The integ function returns the integral of the interpolating function
126 between two points. By default it will barf if you try to extrapolate,
127 to comply silently if one of the integration limits is out of range
128 pass the option {Extrapolate => 1}
129
130 Usage:
131
132 $result = $spl->integ($a,$b,$opt);
133
134 Example:
135
136 my $res = $spl->integ($a,$b)
137 $res = $spl->integ($a,$b,{Extrapolate => 0}) #same as above
138
139 # silently comply if $a or $b are out of range
140 $res = $spl->eval($a,$b,{Extrapolate => 1})
141
143 Feedback is welcome.
144
146 PDL
147
148 The GSL documentation is online at
149
150 http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
151
153 This file copyright (C) 2003 Andres Jordan <andresj@physics.rut‐
154 gers.edu> All rights reserved. There is no warranty. You are allowed to
155 redistribute this software/documentation under certain conditions. For
156 details, see the file COPYING in the PDL distribution. If this file is
157 separated from the PDL distribution, the copyright notice should be
158 included in the file.
159
160 The GSL interpolation module was written by Gerard Jungman.
161
162
163
164perl v5.8.8 2006-12-02 INTERP(3)