# 2 List of in-built functions

The following is a complete list of the default functions which are built into Pyxplot. Except where stated otherwise, functions may be assumed to expect numerical arguments. Where arguments are represented by the letter , they must usually be real numbers. Where arguments are represented by the letter , they are usually permitted to be complex numbers. Functions which are defined within Pyxplot’s default modules, but which are not in its default namespace, are listed in subsections below.

abs()
The abs() function returns the absolute magnitude of , where may be any general complex number. The output shares the physical dimensions of , if any.

acos()
The acos() function returns the arccosine of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

acosec()
The acosec() function returns the arccosecant of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

acosech()
The acosech() function returns the hyperbolic arccosecant of , where may be any general dimensionless complex number. The output is dimensionless.

acosh()
The acosh() function returns the hyperbolic arccosine of , where may be any general dimensionless complex number. The output is dimensionless.

acot()
The acot() function returns the arccotangent of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

acoth()
The acoth() function returns the hyperbolic arccotangent of , where may be any general dimensionless complex number. The output is dimensionless.

acsc()
The acsc() function returns the arccosecant of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

acsch()
The acsch() function returns the hyperbolic arccosecant of , where may be any general dimensionless complex number. The output is dimensionless.

airy_ai()
The airy_ai() function returns the Airy function Ai evaluated at , where may be any dimensionless complex number.

airy_ai_diff()
The airy_ai_diff() function returns the first derivative of the Airy function Ai evaluated at , where may be any dimensionless complex number.

airy_bi()
The airy_bi() function returns the Airy function Bi evaluated at , where may be any dimensionless complex number.

airy_bi_diff()
The airy_bi_diff() function returns the first derivative of the Airy function Bi evaluated at , where may be any dimensionless complex number.

arg()
The arg() function returns the argument of the complex number , which may have any physical dimensions. The output has physical dimensions of angle.

asec()
The asec() function returns the arcsecant of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

asech()
The asech() function returns the hyperbolic arcsecant of , where may be any general dimensionless complex number. The output is dimensionless.

asin()
The asin() function returns the arcsine of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

asinh()
The asinh() function returns the hyperbolic arcsine of , where may be any general dimensionless complex number. The output is dimensionless.

atan()
The atan() function returns the arctangent of , where may be any general dimensionless complex number. The output has physical dimensions of angle.

atan2()
The atan2() function returns the arctangent of . Unlike atan(), atan2() takes account of the signs of both and to remove the degeneracy between and . and must be real numbers, and must have matching physical dimensions.

atanh()
The atanh() function returns the hyperbolic arctangent of , where may be any general dimensionless complex number. The output is dimensionless.

besseli()
The besseli() function evaluates the th regular modified spherical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselI()
The besselI() function evaluates the th regular modified cylindrical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselj()
The besselj() function evaluates the th regular spherical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselJ()
The besselJ() function evaluates the th regular cylindrical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselk()
The besselk() function evaluates the th irregular modified spherical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselK()
The besselK() function evaluates the th irregular modified cylindrical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

bessely()
The bessely() function evaluates the th irregular spherical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

besselY()
The besselY() function evaluates the th irregular cylindrical Bessel function at . must be a positive dimensionless real integer. must be a real dimensionless number.

beta()
The beta() function evaluates the beta function , where and must be dimensionless real numbers.

call()
The call() function calls the function with the arguments contained in the list .

ceil()
The ceil() function returns the smallest integer value greater than or equal to , where must be a dimensionless real number.

chr()
The chr() function returns the character with numerical ASCII code .

classOf()
The classOf() function returns the class prototype of the object x, where may be of any object type.

cmp()
The cmp() function returns if , if and zero if .

cmyk()
The cmyk() function returns a color object with the specified CMYK components in the range 0–1.

conjugate()
The conjugate() function returns the complex conjugate of the complex number , which may have any physical dimensions.

copy()
The copy() function returns a copy of the data structure , which may be of any object type. Nested data structures are not copied; see deepcopy() for this.

cos()
The cos() function returns the cosine of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

cosec()
The cosec() function returns the cosecant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

cosech()
The cosech() function returns the hyperbolic cosecant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

cosh()
The cosh() function returns the hyperbolic cosine of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

cot()
The cot() function returns the cotangent of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

coth()
The coth() function returns the hyperbolic cotangent of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

cross()
The cross() function returns the vector cross product of the three-component vectors and .

csc()
The csc() function returns the cosecant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

csch()
The csch() function returns the hyperbolic cosecant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

deepcopy()
The deepcopy() function returns a deep copy of the data structure , copying also any nested data structures. may be of any object type.

degrees()
The degrees() function takes a real input which should either have physical units of angle, or be dimensionless, in which case it is assumed to be measured in radians. The output is the dimensionless number of degrees in .

diff_dx()
The diff_dx() function numerically differentiates an expression with respect to at , using a step size of . ‘`x`’ can be replaced by any variable name of fewer than 16 characters, and so, for example, the `diff_dfoobar()` function differentiates an expression with respect to the variable `foobar`. The expression may optionally be enclosed in quotes. Both , and the output differential, may be complex numbers with any physical unit. The step size may optionally be omitted, in which case a value of is used. The following example would differentiate the expression with respect to :
`print diff_dx("x**2", 1, 1e-6)`.

ellipticintE()
The ellipticintE() function evaluates the following complete elliptic integral:

ellipticintK()
The ellipticintK() function evaluates the following complete elliptic integral:

ellipticintP()
The ellipticintP() function evaluates the following complete elliptic integral:

erf()
The erf() function evaluates the error function at , where must be a dimensionless real number.

erfc()
The erfc() function evaluates the complementary error function at , where must be a dimensionless real number.

eval()
The eval() function evaluates the string expression and returns the result.

exp()
The exp() function returns , where can be a complex number but must either be dimensionless or be an angle.

expint()
The expint() function evaluates the following integral:

must be a positive real dimensionless integer and must be a real dimensionless number.

expm1()
The expm1() function accurately evaluates , where must be a dimensionless real number.

factors()
The factors() function returns a list of the factors of the integer .

finite()
The finite() function returns one if is a finite number, and zero otherwise.

floor()
The floor() function returns the largest integer value smaller than or equal to , where must be a dimensionless real number.

gamma()
The gamma() function evaluates the gamma function , where must be a dimensionless real number.

gcd(...)
The gcd(...) function returns the greatest common divisor (a.k.a. highest common factor) of its arguments, which should be dimensionless non-zero positive integers.

globals()
The globals() function returns a dictionary of all currently-defined global variables.

gray()
The gray() function returns color object representing a shade of gray with brightness in the range 0–1.

grey()
The grey() function returns color object representing a shade of gray with brightness in the range 0–1.

hcf(...)
The hcf(...) function returns the highest common factor (a.k.a. greatest common divisor) of its arguments, which should be dimensionless non-zero positive integers.

heaviside()
The heaviside() function returns the Heaviside function, defined to be one for and zero otherwise. must be a dimensionless real number.

hsb()
The hsb() function returns color object with specified hue, saturation and brightness in the range 0–1.

hyperg_0F1()
The hyperg_0F1() function evaluates the hypergeometric function . All inputs must be dimensionless real numbers. For reference, the implementation used is GSL’s `gsl_sf_hyperg_0F1` function.

hyperg_1F1()
The hyperg_1F1() function evaluates the hypergeometric function . All inputs must be dimensionless real numbers. For reference, the implementation used is GSL’s `gsl_sf_hyperg_1F1` function.

hyperg_2F0()
The hyperg_2F0() function evaluates the hypergeometric function . All inputs must be dimensionless real numbers.For reference, the implementation used is GSL’s `gsl_sf_hyperg_2F0` function.

hyperg_2F1()
The hyperg_2F1() function evaluates the hypergeometric function . All inputs must be dimensionless real numbers. For reference, the implementation used is GSL’s `gsl_sf_hyperg_2F1` function. This implementation cannot evaluate the region .

hyperg_U()
The hyperg_U() function evaluates the hypergeometric function . All inputs must be dimensionless real numbers. For reference, the implementation used is GSL’s `gsl_sf_hyperg_U` function.

hypot(...)
The hypot(...) function returns the quadrature sum of its arguments, . Its arguments must be numerical, but may have any physical dimensions so long as they match. They can be complex numbers.

Im()
The Im() function returns the imaginary part of the complex number , which may have any physical units. The number returned shares the same physical units as .

int_dx()
The int_dx() function numerically integrates an expression with respect to between and . ‘`x`’ can be replaced by any variable name of fewer than 16 characters, and so, for example, the `int_dfoobar()` function integrates an expression with respect to the variable `foobar`. The expression may optionally be enclosed in quotes. and may have any physical units, so long as they match, but must be real numbers. The output integral may be a complex number, and may have any physical dimensions. The following example would integrate the expression with respect to between m and m:
`print int_dx("x**2", 1*unit(m), 2*unit(m))`.

jacobi_cn()
The jacobi_cn() function evaluates a Jacobi elliptic function; it returns the value where is defined by the integral

jacobi_dn()
The jacobi_dn() function evaluates a Jacobi elliptic function; it returns the value where is defined by the integral

jacobi_sn()
The jacobi_sn() function evaluates a Jacobi elliptic function; it returns the value where is defined by the integral

lambert_W0()
The lambert_W0() function evaluates the principal real branch of the Lambert W function, for which when .

lambert_W1()
The lambert_W1() function evaluates the secondary real branch of the Lambert W function, for which when .

lcm(...)
The lcm(...) function returns the lowest common multiple of its arguments, which should be dimensionless positive integers.

ldexp()
The ldexp() function returns times for integer y, where both and must be real.

legendreP()
The legendreP() function evaluates the th Legendre polynomial at , where must be a positive dimensionless real integer and must be a real dimensionless number.

legendreQ()
The legendreQ() function evaluates the th Legendre function at , where must be a positive dimensionless real integer and must be a real dimensionless number.

len()
The len() function returns the length of the object . The may be the length of a string, or the number of entries in a compound data type.

ln()
The ln() function returns the natural logarithm of , where may be any complex dimensionless number.

locals()
The locals() function returns a dictionary of all currently-defined local variables in the present scope.

log()
The log() function returns the natural logarithm of , where may be any complex dimensionless number.

log10()
The log10() function returns the logarithm to base 10 of , where may be any complex dimensionless number.

logn()
The logn() function returns the logarithm of to base .

lrange([],,[])
The lrange([],,[]) function returns a vector of numbers between and with uniform multiplicative spacing . If not specified, and . If two arguments are specified, these are interpreted as and . The arguments and may have any physical units, so long as they match. must be a dimensionless number.

matrix(...)
The matrix(...) function creates a new matrix object. See `types.matrix`.

max(...)
The max(...) function returns the highest-valued of its arguments, which may be of any object type and may have any physical dimensions, so long as they match. If either input is complex, the input with the larger magnitude is returned. If a single vector or list object is supplied, the highest-valued item in the vector or list is returned.

min(...)
The min(...) function returns the lowest-valued of its arguments, where may be of any object type and may have any physical dimensions, so long as they match. If either input is complex, the input with the smaller magnitude is returned. If a single vector or list object is supplied, the lowest-valued item in the vector or list is returned.

mod()
The mod() function returns the remainder of , where and may have any physical dimensions so long as they match but must both be real.

module(...)
The module(...) function creates a new module object. See `types.module`.

open([,])
The open([,]) function opens the file with string access mode , and returns a file handle object.

ord()
The ord() function returns the ASCII code of the first character of the string .

ordinal()
The ordinal() function returns an ordinal string, for example, “1st”, “2nd” or “3rd”, for any positive dimensionless real number .

pow()
The pow() function returns to the power of , where and may both be complex numbers and may have any physical dimensions but must be dimensionless. It not not permitted for to be complex if is not dimensionless, since this would lead to an output with complex physical dimensions.

prime()
The prime() function returns one if floor() is a prime number and zero otherwise.

primeFactors()
The primeFactors() function returns a list of the prime factors of the integer .

radians()
The radians() function takes a real input which should either have physical units of angle, or be dimensionless, in which case it is assumed to be measured in degrees. The output is the dimensionless number of radians in .

raise()
The raise() function raises the exception , with error string . should be an exception object; should be an error message string.

range([],,[])
The range([],,[]) function returns a vector of uniformly-spaced numbers between and , with stepsize . If not specified, and . If two arguments are specified, these are interpreted as and . The arguments may have any physical units, so long as they match.

Re()
The Re() function returns the real part of the complex number , which may have any physical units. The number returned shares the same physical units as .

rgb()
The rgb() function returns a color object with specified RGB components in the range 0–1.

romanNumeral()
The romanNumeral() function returns the Roman numeral representing the number , for any positive dimensionless real input less than 10,000.

root()
The root() function returns the th root of . may be any complex number, and may have any physical dimensions. must be a dimensionless integer. When complex arithmetic is enabled, and whenever is positive, this function is entirely equivalent to `pow(z,1/n)`. However, when is negative and complex arithmetic is disabled, the expression `pow(z,1/n)` may not be evaluated, since it will in general have a small imaginary part for any finite-precision floating-point representation of . The expression `root(z,n)`, on the other hand, may be evaluated under such conditions, providing that is an odd integer.

round()
The round() function rounds the value to the nearest integer. If is exactly halfway between integers, it is rounded away from zero. must be a dimensionless real number.

sec()
The sec() function returns the secant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

sech()
The sech() function returns the hyperbolic secant of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

sgn()
The sgn() function returns 1 if x is greater than zero, -1 if x is less than zero, and 0 if x equals zero.

sin()
The sin() function returns the sine of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

sinc()
The sinc() function returns the sinc function for any complex number , which may either be dimensionless, in which case it is understood to be measured in radians, or have physical dimensions of angle. The result is dimensionless.

sinh()
The sinh() function returns the hyperbolic sine of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

sqrt()
The sqrt() function returns the square root of , which may be any complex number and may have any physical dimensions.

sum(...)
The sum(...) function returns the sum of its arguments, which be of any object type, and may have any physical units, so long as it is possible to add them together.

tan()
The tan() function returns the tangent of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

tanh()
The tanh() function returns the hyperbolic tangent of , where may be any complex number and must either have physical dimensions of angle or be a dimensionless number, in which case it is understood to be measured in radians.

texify()
The texify() function takes a string representation of an algebraic expression as its input, e.g. “`(x/3)**2`”, and returns a latex representation of it.

texifyText()
The texifyText() function returns a string of latex text corresponding to the supplied text string, with any reserved characters escaped.

tophat()
The tophat() function returns one if , and zero otherwise. Both inputs must be real, but may have any physical dimensions so long as they match.

typeOf()
The typeOf() function returns the type of the object .

unit(…)
The unit(…) function multiplies a number by a physical unit. The string inside the brackets should consist of a string of the names of physical units, multiplied together with the `*` operator, divided using the `/` operator, or raised by numeric powers using the `^` operator. The list may be commenced with a numeric constant, for example: `unit(2*m^2/s)`.

vector(...)
The vector(...) function creates a new vector object. See `types.vector`.

zernike()
The zernike() function evaluates the Zernike polynomial , where and are non-negative integers with , is the radial coordinate in the range and is the azimuthal coordinate.

zernikeR()
The zernikeR() function evaluates the radial Zernike polynomial , where and are non-negative integers with and is the radial coordinate in the range .

zeta()
The zeta() function evaluates the Riemann zeta function for any dimensionless number .

- 2.1 The `ast` module
- 2.2 The `colors` module
- 2.3 The `exceptions` module
- 2.4 The `fractals` module
- 2.5 The `os` module
- 2.6 The `os.path` module
- 2.7 The `phy` module
- 2.8 The `random` module
- 2.9 The `stats` module
- 2.10 The `time` module
- 2.11 The `types` module