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

NAME

6       PDL::Math - extended mathematical operations and special functions
7

SYNOPSIS

9        use PDL::Math;
10
11        use PDL::Graphics::TriD;
12        imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)];
13

DESCRIPTION

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

FUNCTIONS

26   acos
27         Signature: (a(); [o]b())
28
29       The usual trigonometric function.
30        Works inplace.
31
32       acos processes bad values.  It will set the bad-value flag of all
33       output ndarrays if the flag is set for any of the input ndarrays.
34
35   asin
36         Signature: (a(); [o]b())
37
38       The usual trigonometric function.
39        Works inplace.
40
41       asin processes bad values.  It will set the bad-value flag of all
42       output ndarrays if the flag is set for any of the input ndarrays.
43
44   atan
45         Signature: (a(); [o]b())
46
47       The usual trigonometric function.
48        Works inplace.
49
50       atan processes bad values.  It will set the bad-value flag of all
51       output ndarrays if the flag is set for any of the input ndarrays.
52
53   cosh
54         Signature: (a(); [o]b())
55
56       The standard hyperbolic function.
57        Works inplace.
58
59       cosh processes bad values.  It will set the bad-value flag of all
60       output ndarrays if the flag is set for any of the input ndarrays.
61
62   sinh
63         Signature: (a(); [o]b())
64
65       The standard hyperbolic function.
66        Works inplace.
67
68       sinh processes bad values.  It will set the bad-value flag of all
69       output ndarrays if the flag is set for any of the input ndarrays.
70
71   tan
72         Signature: (a(); [o]b())
73
74       The usual trigonometric function.
75        Works inplace.
76
77       tan processes bad values.  It will set the bad-value flag of all output
78       ndarrays if the flag is set for any of the input ndarrays.
79
80   tanh
81         Signature: (a(); [o]b())
82
83       The standard hyperbolic function.
84        Works inplace.
85
86       tanh processes bad values.  It will set the bad-value flag of all
87       output ndarrays if the flag is set for any of the input ndarrays.
88
89   ceil
90         Signature: (a(); [o]b())
91
92       Round to integer values in floating-point format. Works inplace.
93
94       ceil processes bad values.  It will set the bad-value flag of all
95       output ndarrays if the flag is set for any of the input ndarrays.
96
97   floor
98         Signature: (a(); [o]b())
99
100       Round to integer values in floating-point format. Works inplace.
101
102       floor processes bad values.  It will set the bad-value flag of all
103       output ndarrays if the flag is set for any of the input ndarrays.
104
105   rint
106         Signature: (a(); [o]b())
107
108       Round to integer values in floating-point format.
109
110       rint uses the 'round half to even' rounding method (also known as
111       banker's rounding).  Half-integers are rounded to the nearest even
112       number. This avoids a slight statistical bias inherent in always
113       rounding half-integers up or away from zero.
114
115       If you are looking to round half-integers up (regardless of sign), try
116       "floor($x+0.5)".  If you want to round half-integers away from zero,
117       try "ceil(abs($x)+0.5)*($x<=>0)". Works inplace.
118
119       rint processes bad values.  It will set the bad-value flag of all
120       output ndarrays if the flag is set for any of the input ndarrays.
121
122   pow
123         Signature: (a(); b(); [o]c())
124
125       Synonym for `**'. Works inplace.
126
127       pow processes bad values.  It will set the bad-value flag of all output
128       ndarrays if the flag is set for any of the input ndarrays.
129
130   acosh
131         Signature: (a(); [o]b())
132
133       The standard hyperbolic function.
134        Works inplace.
135
136       acosh processes bad values.  It will set the bad-value flag of all
137       output ndarrays if the flag is set for any of the input ndarrays.
138
139   asinh
140         Signature: (a(); [o]b())
141
142       The standard hyperbolic function.
143        Works inplace.
144
145       asinh processes bad values.  It will set the bad-value flag of all
146       output ndarrays if the flag is set for any of the input ndarrays.
147
148   atanh
149         Signature: (a(); [o]b())
150
151       The standard hyperbolic function.
152        Works inplace.
153
154       atanh processes bad values.  It will set the bad-value flag of all
155       output ndarrays if the flag is set for any of the input ndarrays.
156
157   erf
158         Signature: (a(); [o]b())
159
160       The error function. Works inplace.
161
162       erf processes bad values.  It will set the bad-value flag of all output
163       ndarrays if the flag is set for any of the input ndarrays.
164
165   erfc
166         Signature: (a(); [o]b())
167
168       The complement of the error function. Works inplace.
169
170       erfc processes bad values.  It will set the bad-value flag of all
171       output ndarrays if the flag is set for any of the input ndarrays.
172
173   bessj0
174         Signature: (a(); [o]b())
175
176       The regular Bessel function of the first kind, J_n Works inplace.
177
178       bessj0 processes bad values.  It will set the bad-value flag of all
179       output ndarrays if the flag is set for any of the input ndarrays.
180
181   bessj1
182         Signature: (a(); [o]b())
183
184       The regular Bessel function of the first kind, J_n Works inplace.
185
186       bessj1 processes bad values.  It will set the bad-value flag of all
187       output ndarrays if the flag is set for any of the input ndarrays.
188
189   bessy0
190         Signature: (a(); [o]b())
191
192       The regular Bessel function of the second kind, Y_n. Works inplace.
193
194       bessy0 processes bad values.  It will set the bad-value flag of all
195       output ndarrays if the flag is set for any of the input ndarrays.
196
197   bessy1
198         Signature: (a(); [o]b())
199
200       The regular Bessel function of the second kind, Y_n. Works inplace.
201
202       bessy1 processes bad values.  It will set the bad-value flag of all
203       output ndarrays if the flag is set for any of the input ndarrays.
204
205   bessjn
206         Signature: (a(); int n(); [o]b())
207
208       The regular Bessel function of the first kind, J_n .  This takes a
209       second int argument which gives the order of the function required.
210        Works inplace.
211
212       bessjn processes bad values.  It will set the bad-value flag of all
213       output ndarrays if the flag is set for any of the input ndarrays.
214
215   bessyn
216         Signature: (a(); int n(); [o]b())
217
218       The regular Bessel function of the first kind, Y_n .  This takes a
219       second int argument which gives the order of the function required.
220        Works inplace.
221
222       bessyn processes bad values.  It will set the bad-value flag of all
223       output ndarrays if the flag is set for any of the input ndarrays.
224
225   lgamma
226         Signature: (a(); [o]b(); int[o]s())
227
228       log gamma function
229
230       This returns 2 ndarrays -- the first set gives the log(gamma) values,
231       while the second set, of integer values, gives the sign of the gamma
232       function.  This is useful for determining factorials, amongst other
233       things.
234
235       lgamma processes bad values.  It will set the bad-value flag of all
236       output ndarrays if the flag is set for any of the input ndarrays.
237
238   badmask
239         Signature: (a(); b(); [o]c())
240
241       Clears all "infs" and "nans" in $a to the corresponding value in $b.
242
243       badmask can be run with $x inplace:
244
245         badmask($x->inplace,0);
246         $x->inplace->badmask(0);
247
248       If bad values are present, these are also cleared.
249
250   isfinite
251         Signature: (a(); int [o]mask())
252
253       Sets $mask true if $a is not a "NaN" or "inf" (either positive or
254       negative). Works inplace.
255
256       Bad values are treated as "NaN" or "inf".
257
258   erfi
259         Signature: (a(); [o]b())
260
261       The inverse of the error function. Works inplace.
262
263       erfi processes bad values.  It will set the bad-value flag of all
264       output ndarrays if the flag is set for any of the input ndarrays.
265
266   ndtri
267         Signature: (a(); [o]b())
268
269       The value for which the area under the Gaussian probability density
270       function (integrated from minus infinity) is equal to the argument (cf
271       "erfi"). Works inplace.
272
273       ndtri processes bad values.  It will set the bad-value flag of all
274       output ndarrays if the flag is set for any of the input ndarrays.
275
276   polyroots
277         Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m))
278
279       Complex roots of a complex polynomial, given coefficients in order of
280       decreasing powers.
281
282        ($rr, $ri) = polyroots($cr, $ci);
283
284       polyroots does not process bad values.  It will set the bad-value flag
285       of all output ndarrays if the flag is set for any of the input
286       ndarrays.
287

BUGS

289       Hasn't been tested on all platforms to ensure Cephes versions are
290       picked up automatically and used correctly.
291

AUTHOR

293       Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl
294       Glazebrook (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka
295       (Tuomas.Lukka@helsinki.fi).  Portions (C) Craig DeForest 2002
296       (deforest@boulder.swri.edu).
297
298       All rights reserved. There is no warranty. You are allowed to
299       redistribute this software / documentation under certain conditions.
300       For details, see the file COPYING in the PDL distribution. If this file
301       is separated from the PDL distribution, the PDL copyright notice should
302       be included in the file.
303
304
305
306perl v5.34.0                      2021-08-16                           Math(3)
Impressum