1Math(3) User Contributed Perl Documentation Math(3)
2
3
4
6 PDL::Math - extended mathematical operations and special functions
7
9 use PDL::Math;
10
11 use PDL::Graphics::TriD;
12 imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)];
13
15 This module extends PDL with more advanced mathematical functions than
16 provided by standard Perl.
17
18 All the functions have one input pdl, and one output, unless otherwise
19 stated.
20
21 Many of the functions are linked from the system maths library or the
22 Cephes maths library (determined when PDL is compiled); a few are
23 implemented entirely in PDL.
24
26 acos
27 Signature: (a(); [o]b())
28
29 The usual trigonometric function. Works inplace.
30
31 acos does handle bad values. It will set the bad-value flag of all
32 output piddles if the flag is set for any of the input piddles.
33
34 asin
35 Signature: (a(); [o]b())
36
37 The usual trigonometric function. Works inplace.
38
39 asin does handle bad values. It will set the bad-value flag of all
40 output piddles if the flag is set for any of the input piddles.
41
42 atan
43 Signature: (a(); [o]b())
44
45 The usual trigonometric function. Works inplace.
46
47 atan does handle bad values. It will set the bad-value flag of all
48 output piddles if the flag is set for any of the input piddles.
49
50 cosh
51 Signature: (a(); [o]b())
52
53 The standard hyperbolic function. Works inplace.
54
55 cosh does handle bad values. It will set the bad-value flag of all
56 output piddles if the flag is set for any of the input piddles.
57
58 sinh
59 Signature: (a(); [o]b())
60
61 The standard hyperbolic function. Works inplace.
62
63 sinh does handle bad values. It will set the bad-value flag of all
64 output piddles if the flag is set for any of the input piddles.
65
66 tan
67 Signature: (a(); [o]b())
68
69 The usual trigonometric function. Works inplace.
70
71 tan does handle bad values. It will set the bad-value flag of all
72 output piddles if the flag is set for any of the input piddles.
73
74 tanh
75 Signature: (a(); [o]b())
76
77 The standard hyperbolic function. Works inplace.
78
79 tanh does handle bad values. It will set the bad-value flag of all
80 output piddles if the flag is set for any of the input piddles.
81
82 ceil
83 Signature: (a(); [o]b())
84
85 Round to integral values in floating-point format. Works inplace.
86
87 ceil does handle bad values. It will set the bad-value flag of all
88 output piddles if the flag is set for any of the input piddles.
89
90 floor
91 Signature: (a(); [o]b())
92
93 Round to integral values in floating-point format. Works inplace.
94
95 floor does handle bad values. It will set the bad-value flag of all
96 output piddles if the flag is set for any of the input piddles.
97
98 rint
99 Signature: (a(); [o]b())
100
101 Round to integral values in floating-point format. Works inplace.
102
103 rint does handle bad values. It will set the bad-value flag of all
104 output piddles if the flag is set for any of the input piddles.
105
106 pow
107 Signature: (a(); b(); [o]c())
108
109 Synonym for `**'. Works inplace.
110
111 pow does handle bad values. It will set the bad-value flag of all
112 output piddles if the flag is set for any of the input piddles.
113
114 acosh
115 Signature: (a(); [o]b())
116
117 The standard hyperbolic function. Works inplace.
118
119 acosh does handle bad values. It will set the bad-value flag of all
120 output piddles if the flag is set for any of the input piddles.
121
122 asinh
123 Signature: (a(); [o]b())
124
125 The standard hyperbolic function. Works inplace.
126
127 asinh does handle bad values. It will set the bad-value flag of all
128 output piddles if the flag is set for any of the input piddles.
129
130 atanh
131 Signature: (a(); [o]b())
132
133 The standard hyperbolic function. Works inplace.
134
135 atanh does handle bad values. It will set the bad-value flag of all
136 output piddles if the flag is set for any of the input piddles.
137
138 erf
139 Signature: (a(); [o]b())
140
141 The error function. Works inplace.
142
143 erf does handle bad values. It will set the bad-value flag of all
144 output piddles if the flag is set for any of the input piddles.
145
146 erfc
147 Signature: (a(); [o]b())
148
149 The complement of the error function. Works inplace.
150
151 erfc does handle bad values. It will set the bad-value flag of all
152 output piddles if the flag is set for any of the input piddles.
153
154 bessj0
155 Signature: (a(); [o]b())
156
157 The standard Bessel function. Works inplace.
158
159 bessj0 does handle bad values. It will set the bad-value flag of all
160 output piddles if the flag is set for any of the input piddles.
161
162 bessj1
163 Signature: (a(); [o]b())
164
165 The standard Bessel function. Works inplace.
166
167 bessj1 does handle bad values. It will set the bad-value flag of all
168 output piddles if the flag is set for any of the input piddles.
169
170 bessy0
171 Signature: (a(); [o]b())
172
173 The standard Bessel function. Works inplace.
174
175 bessy0 does handle bad values. It will set the bad-value flag of all
176 output piddles if the flag is set for any of the input piddles.
177
178 bessy1
179 Signature: (a(); [o]b())
180
181 The standard Bessel function. Works inplace.
182
183 bessy1 does handle bad values. It will set the bad-value flag of all
184 output piddles if the flag is set for any of the input piddles.
185
186 bessjn
187 Signature: (a(); int n(); [o]b())
188
189 The standard Bessel function. This has a second integer argument which
190 gives the order of the function required.
191 Works inplace.
192
193 bessjn does handle bad values. It will set the bad-value flag of all
194 output piddles if the flag is set for any of the input piddles.
195
196 bessyn
197 Signature: (a(); int n(); [o]b())
198
199 The standard Bessel function. This has a second integer argument which
200 gives the order of the function required.
201 Works inplace.
202
203 bessyn does handle bad values. It will set the bad-value flag of all
204 output piddles if the flag is set for any of the input piddles.
205
206 lgamma
207 Signature: (a(); [o]b(); int[o]s())
208
209 log gamma function
210
211 This returns 2 piddles -- the first set gives the log(gamma) values,
212 while the second set, of integer values, gives the sign of the gamma
213 function. This is useful for determining factorials, amongst other
214 things.
215
216 lgamma does handle bad values. It will set the bad-value flag of all
217 output piddles if the flag is set for any of the input piddles.
218
219 badmask
220 Signature: (a(); b(); [o]c())
221
222 Clears all "infs" and "nans" in $a to the corresponding value in $b.
223
224 badmask can be run with $a inplace:
225
226 badmask($a->inplace,0);
227 $a->inplace->badmask(0);
228
229 If bad values are present, these are also cleared.
230
231 isfinite
232 Signature: (a(); int [o]mask())
233
234 Sets $mask true if $a is not a "NaN" or "inf" (either positive or
235 negative). Works inplace.
236
237 Bad values are treated as "NaN" or "inf".
238
239 erfi
240 Signature: (a(); [o]b())
241
242 The inverse of the error function. Works inplace.
243
244 erfi does handle bad values. It will set the bad-value flag of all
245 output piddles if the flag is set for any of the input piddles.
246
247 ndtri
248 Signature: (a(); [o]b())
249
250 The value for which the area under the Gaussian probability density
251 function (integrated from minus infinity) is equal to the argument (cf
252 erfi). Works inplace.
253
254 ndtri does handle bad values. It will set the bad-value flag of all
255 output piddles if the flag is set for any of the input piddles.
256
257 polyroots
258 Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m))
259
260 Complex roots of a complex polynomial, given coefficients in order of
261 decreasing powers.
262
263 ($rr, $ri) = polyroots($cr, $ci);
264
265 polyroots does not process bad values. It will set the bad-value flag
266 of all output piddles if the flag is set for any of the input piddles.
267
269 Hasn't been tested on all platforms to ensure Cephes versions are
270 picked up automatically and used correctly.
271
273 Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl
274 Glazebrook (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka
275 (Tuomas.Lukka@helsinki.fi). Portions (C) Craig DeForest 2002
276 (deforest@boulder.swri.edu).
277
278 All rights reserved. There is no warranty. You are allowed to
279 redistribute this software / documentation under certain conditions.
280 For details, see the file COPYING in the PDL distribution. If this file
281 is separated from the PDL distribution, the PDL copyright notice should
282 be included in the file.
283
284
285
286perl v5.12.3 2011-03-31 Math(3)