.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math 3pm" .TH Math 3pm "2012-05-30" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PDL::Math \- extended mathematical operations and special functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use PDL::Math; \& \& use PDL::Graphics::TriD; \& imag3d [SURF2D,bessj0(rvals(zeroes(50,50))/2)]; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module extends \s-1PDL\s0 with more advanced mathematical functions than provided by standard Perl. .PP All the functions have one input pdl, and one output, unless otherwise stated. .PP Many of the functions are linked from the system maths library or the Cephes maths library (determined when \s-1PDL\s0 is compiled); a few are implemented entirely in \s-1PDL\s0. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "acos" .IX Subsection "acos" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The usual trigonometric function. Works inplace. .PP acos does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "asin" .IX Subsection "asin" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The usual trigonometric function. Works inplace. .PP asin does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "atan" .IX Subsection "atan" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The usual trigonometric function. Works inplace. .PP atan does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "cosh" .IX Subsection "cosh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP cosh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "sinh" .IX Subsection "sinh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP sinh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "tan" .IX Subsection "tan" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The usual trigonometric function. Works inplace. .PP tan does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "tanh" .IX Subsection "tanh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP tanh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "ceil" .IX Subsection "ceil" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP Round to integer values in floating-point format. Works inplace. .PP ceil does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "floor" .IX Subsection "floor" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP Round to integer values in floating-point format. Works inplace. .PP floor does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "rint" .IX Subsection "rint" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP Round to integer values in floating-point format. .PP rint uses the 'round half to even' rounding method (also known as banker's rounding). Half-integers are rounded to the nearest even number. This avoids a slight statistical bias inherent in always rounding half-integers up or away from zero. .PP If you are looking to round half-integers up (regardless of sign), try \&\f(CW\*(C`floor($x+0.5)\*(C'\fR. If you want to round half-integers away from zero, try \f(CW\*(C`floor(abs($x)+0.5)*($x<=>0)\*(C'\fR. Works inplace. .PP rint does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "pow" .IX Subsection "pow" .Vb 1 \& Signature: (a(); b(); [o]c()) .Ve .PP Synonym for `**'. Works inplace. .PP pow does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "acosh" .IX Subsection "acosh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP acosh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "asinh" .IX Subsection "asinh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP asinh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "atanh" .IX Subsection "atanh" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The standard hyperbolic function. Works inplace. .PP atanh does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "erf" .IX Subsection "erf" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The error function. Works inplace. .PP erf does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "erfc" .IX Subsection "erfc" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The complement of the error function. Works inplace. .PP erfc does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessj0" .IX Subsection "bessj0" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The regular Bessel function of the first kind, J_n Works inplace. .PP bessj0 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessj1" .IX Subsection "bessj1" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The regular Bessel function of the first kind, J_n Works inplace. .PP bessj1 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessy0" .IX Subsection "bessy0" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The regular Bessel function of the second kind, Y_n. Works inplace. .PP bessy0 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessy1" .IX Subsection "bessy1" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The regular Bessel function of the second kind, Y_n. Works inplace. .PP bessy1 does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessjn" .IX Subsection "bessjn" .Vb 1 \& Signature: (a(); int n(); [o]b()) .Ve .PP The regular Bessel function of the first kind, J_n \&. This takes a second int argument which gives the order of the function required. Works inplace. .PP bessjn does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "bessyn" .IX Subsection "bessyn" .Vb 1 \& Signature: (a(); int n(); [o]b()) .Ve .PP The regular Bessel function of the first kind, Y_n \&. This takes a second int argument which gives the order of the function required. Works inplace. .PP bessyn does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "lgamma" .IX Subsection "lgamma" .Vb 1 \& Signature: (a(); [o]b(); int[o]s()) .Ve .PP log gamma function .PP This returns 2 piddles \*(-- the first set gives the log(gamma) values, while the second set, of integer values, gives the sign of the gamma function. This is useful for determining factorials, amongst other things. .PP lgamma does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "badmask" .IX Subsection "badmask" .Vb 1 \& Signature: (a(); b(); [o]c()) .Ve .PP Clears all \f(CW\*(C`infs\*(C'\fR and \f(CW\*(C`nans\*(C'\fR in \f(CW$a\fR to the corresponding value in \f(CW$b\fR. .PP badmask can be run with \f(CW$a\fR inplace: .PP .Vb 2 \& badmask($a\->inplace,0); \& $a\->inplace\->badmask(0); .Ve .PP If bad values are present, these are also cleared. .SS "isfinite" .IX Subsection "isfinite" .Vb 1 \& Signature: (a(); int [o]mask()) .Ve .PP Sets \f(CW$mask\fR true if \f(CW$a\fR is not a \f(CW\*(C`NaN\*(C'\fR or \f(CW\*(C`inf\*(C'\fR (either positive or negative). Works inplace. .PP Bad values are treated as \f(CW\*(C`NaN\*(C'\fR or \f(CW\*(C`inf\*(C'\fR. .SS "erfi" .IX Subsection "erfi" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The inverse of the error function. Works inplace. .PP erfi does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "ndtri" .IX Subsection "ndtri" .Vb 1 \& Signature: (a(); [o]b()) .Ve .PP The value for which the area under the Gaussian probability density function (integrated from minus infinity) is equal to the argument (cf erfi). Works inplace. .PP ndtri does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SS "polyroots" .IX Subsection "polyroots" .Vb 1 \& Signature: (cr(n); ci(n); [o]rr(m); [o]ri(m)) .Ve .PP Complex roots of a complex polynomial, given coefficients in order of decreasing powers. .PP .Vb 1 \& ($rr, $ri) = polyroots($cr, $ci); .Ve .PP polyroots does not process bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. .SH "BUGS" .IX Header "BUGS" Hasn't been tested on all platforms to ensure Cephes versions are picked up automatically and used correctly. .SH "AUTHOR" .IX Header "AUTHOR" Copyright (C) R.J.R. Williams 1997 (rjrw@ast.leeds.ac.uk), Karl Glazebrook (kgb@aaoepp.aao.gov.au) and Tuomas J. Lukka (Tuomas.Lukka@helsinki.fi). Portions (C) Craig DeForest 2002 (deforest@boulder.swri.edu). .PP All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation under certain conditions. For details, see the file \s-1COPYING\s0 in the \s-1PDL\s0 distribution. If this file is separated from the \s-1PDL\s0 distribution, the \s-1PDL\s0 copyright notice should be included in the file.