2 List of Mathematical Functions

The following is a complete list of the mathematical functions which are defined by default within PyXPlot.

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

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

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

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

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

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

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

airy_­ai($z$)
The airy_­ai($z$) function returns the Airy function Ai evaluated at $z$, where $z$ may be any dimensionless complex number.

airy_­ai_­diff($z$)
The airy_­ai_­diff($z$) function returns the first derivative of the Airy function Ai evaluated at $z$, where $z$ may be any dimensionless complex number.

airy_­bi($z$)
The airy_­bi($z$) function returns the Airy function Bi evaluated at $z$, where $z$ may be any dimensionless complex number.

airy_­bi_­diff($z$)
The airy_­bi_­diff($z$) function returns the first derivative of the Airy function Bi evaluated at $z$, where $z$ may be any dimensionless complex number.

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

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

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

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

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

ast_­Lcdm_­age($H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­age($H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the current age of the Universe in a standard $\Uplambda _\mathrm {CDM}$ cosmology with specified values for Hubble’s constant, $\Omega _\mathrm {M}$ and $\Omega _\Uplambda $. Hubble’s constant should be specified either with physical units of recession velocity per unit distance, or as a dimensionless number, assumed to have implicit units of km/s/Mpc. Suitable input values for a standard cosmology are: $H_0=70$, $\Omega _\mathrm {M}=0.27$ and $\Omega _\Uplambda =0.73$. For more details, see David W. Hogg’s short article Distance measures in cosmology, available online at:
http://arxiv.org/abs/astro-ph/9905116.

ast_­Lcdm_­angscale($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­angscale($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the angular scale of the sky at a redshift of $z$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value has dimensions of distance per unit angle.

ast_­Lcdm_­DA($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­DA($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the angular size distance of objects at a redshift of $z$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value has dimensions of distance.

ast_­Lcdm_­DL($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­DL($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the luminosity distance of objects at a redshift of $z$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value has dimensions of distance.

ast_­Lcdm_­DM($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­DM($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the proper motion distance of objects at a redshift of $z$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value has dimensions of distance.

ast_­Lcdm_­t($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­t($z$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the lookback time to objects at a redshift of $z$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value has dimensions of time. To find the age of the Universe at a redshift of $z$, this value should be subtracted from the output of the ast_Lcdm_age() function.

ast_­Lcdm_­z($t$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $)
The ast_­Lcdm_­z($t$$H_0$$\Omega _\mathrm {M}$$\Omega _\Uplambda $) function is a specialist cosmology function. It returns the redshift corresponding to a lookback time of $t$ in a standard $\Uplambda _\mathrm {CDM}$ cosmology. For details, see the ast_Lcdm_age() function above. The returned value is dimensionless.

ast_­moonphase($JD$)
The ast_­moonphase($JD$) function returns the phase of the Moon, with dimensions of angle, at the time corresponding to the supplied Julian Day number.

ast_­sidereal_­time($JD$)
The ast_­sidereal_­time($JD$) function returns the sidereal time at Greenwich, with dimensions of angle, at the time corresponding to the supplied Julian Day number. This is equal to the right ascension of the stars which are transiting the Greenwich meridian at that time. This function uses the expression for sidereal time adopted in 1982 by the International Astronomical Union (IAU), and which is reproduced in Chapter 12 of Jean Meeus’ book Astronomical Algorithms (1998).

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

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

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

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

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

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

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

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

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

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

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

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

binomialCDF($k,p,n$)
The binomialCDF($k,p,n$) function evaluates the probability of getting fewer than or exactly $k$ successes out of $n$ trials in a binomial distribution with success probability $p$. $k$ and $n$ must be positive real integers. $p$ must be a real number in the range $0\leq p \leq 1$.

binomialPDF($k,p,n$)
The binomialPDF($k,p,n$) function evaluates the probability of getting $k$ successes out of $n$ trials in a binomial distribution with success probability $p$. $k$ and $n$ must be positive real integers. $p$ must be a real number in the range $0\leq p \leq 1$.

Bv($\nu ,T$)
The Bv($\nu ,T$) function returns the power emitted by a blackbody of temperature $T$ at frequency $\nu $ per unit area, per unit solid angle, per unit frequency. $T$ should have physical dimensions of temperature, or be a dimensionless number, in which case it is understood to be a temperature in Kelvin. $\nu $ should have physical dimensions of frequency, or be a dimensionless number, in which case it is understood to be a frequency measured in Hertz. The output has physical dimensions of power per unit area per unit solid angle per unit frequency.

Bvmax($T$)
The Bvmax($T$) function returns the frequency at which the function Bv($\nu ,T$) reaches its maximum, as calculated by the Wien Displacement Law. The inputs are subject to the same constraints as above.

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

chisqCDF($x,nu$)
The chisqCDF($x,nu$) function returns the cumulative probability density at $x$ in a $\chi $-squared distribution with $\nu $ degrees of freedom. $\nu $ must be a positive real dimensionless integer. $x$ must be a positive real dimensionless number.

chisqCDFi($P,nu$)
The chisqCDFi($P,nu$) function returns the point $x$ at which the cumulative probability density in a $\chi $-squared distribution with $\nu $ degrees of freedom is $P$. $\nu $ must be a positive real dimensionless integer. $P$ must be a real number in the range $0\leq p \leq 1$.

chisqPDF($x,nu$)
The chisqPDF($x,nu$) function returns the probability density at $x$ in a $\chi $-squared distribution with $\nu $ degrees of freedom. $\nu $ must be a positive real dimensionless integer. $x$ must be a positive real dimensionless number.

conditionalN($a,b,c$)
The conditionalN($a,b,c$) function returns either $b$, if $a$ is true, or $c$ otherwise. Arguments $b$ and $c$ may be complex and may have any physical dimensions, but may not be strings. Argument $a$ must be a dimensionless real number.

conditionalS($a,b,c$)
The conditionalS($a,b,c$) function returns either $b$, if $a$ is true, or $c$ otherwise. Arguments $b$ and $c$ should be string variables or expressions. Argument $a$ must be a dimensionless real number.

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

cos($z$)
The cos($z$) function returns the cosine of $z$, where $z$ 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($z$)
The cosh($z$) function returns the hyperbolic cosine of $z$, where $z$ 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($z$)
The cot($z$) function returns the cotangent of $z$, where $z$ 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($z$)
The coth($z$) function returns the hyperbolic cotangent of $z$, where $z$ 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.

csc($z$)
The csc($z$) function returns the cosecant of $z$, where $z$ 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($z$)
The csch($z$) function returns the hyperbolic cosecant of $z$, where $z$ 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.

degrees($x$)
The degrees($x$) 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 $x$.

diff_dx($e,x,step$)
The diff_dx($e,x,step$) function numerically differentiates an expression $e$ with respect to $a$ at $x$, using a step size of $step$. ‘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 $e$ may optionally be enclosed in quotes. Both $x$, 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 $10^{-6}$ is used. The following example would differentiate the expression $x^2$ with respect to $x$:
print diff_dx("x**2", 1, 1e-6).

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

  \[  E(k) = \int _0^1 \sqrt {\frac{1-k^2 t^2}{1-t^2}}\, \mathrm{d}t.  \]    

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

  \[  K(k) = \int _0^1 \frac{\mathrm{d}t}{\sqrt {(1-t^2)(1-k^2 t^2)}}.  \]    

ellipticintP($k,n$)
The ellipticintP($k,n$) function evaluates the following complete elliptic integral:

  \[  P(k,n) = \int _0^{\nicefrac {\pi }{2}} \frac{\mathrm{d}\theta }{(1+n\sin ^2\theta )(1-k^2\sin ^2\theta )}. \]    

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

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

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

expint($n,x$)
The expint($n,x$) function evaluates the following integral:

  \[  \int _{t=1}^{t=\infty } \exp (-xt)/t^ n \,  \mathrm{d}t.  \]    

$n$ must be a positive real dimensionless integer and $x$ must be a real dimensionless number.

expm1($x$)
The expm1($x$) function accurately evaluates $\exp (x)-1$, where $x$ must be a dimensionless real number.

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

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

fractal_julia($z$,$z_ c$,$m$)
The fractal_julia($z$,$z_ c$,$m$) function tests whether the point $z$ in the complex plane lies within the Julia set associated with the point $z_ c$ in the complex plane. The expression $z_{n+1} = z_ n^2 + z_ c$ is iterated until either $|z_ n|>2$, in which case the iteration is deemed to have diverged, or until $m$ iterations have been exceeded, in which case it is deemed to have remained bounded. The number of iterations required for divergence is returned, or $m$ is returned if the iteration remained bounded – i.e. the point lies within the numerical approximation to the Julia set.

fractal_mandelbrot($z$,$m$)
The fractal_mandelbrot($z$,$m$) function tests whether the point $z$ in the complex plane lies within the Mandelbrot set. The expression $z_{n+1} = z_ n^2 + z_0$ is iterated until either $|z_ n|>2$, in which case the iteration is deemed to have diverged, or until $m$ iterations have been exceeded, in which case it is deemed to have remained bounded. The number of iterations required for divergence is returned, or $m$ is returned if the iteration remained bounded – i.e. the point lies within the numerical approximation to the Mandelbrot set.

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

gaussianCDF($x,\sigma $)
The gaussianCDF($x,\sigma $) function evaluates the Gaussian cumulative distribution function of standard deviation $\sigma $ at $x$. The distribution is centred upon $x=0$. $x$ and $\sigma $ must both be real, but may have any physical dimensions so long as they match.

gaussianCDFi($x,\sigma $)
The gaussianCDFi($x,\sigma $) function evaluates the inverse Gaussian cumulative distribution function of standard deviation $\sigma $ at $x$. The distribution is centred upon $x=0$. $x$ and $\sigma $ must both be real, but may have any physical dimensions so long as they match.

gaussianPDF($x,\sigma $)
The gaussianPDF($x,\sigma $) function evaluates the Gaussian probability density function of standard deviation $\sigma $ at $x$. The distribution is centred upon $x=0$. $x$ and $\sigma $ must both be real, but may have any physical dimensions so long as they match.

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

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

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

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

hyperg_2F1($a,b,x$)
The hyperg_2F1($a,b,x$) function evaluates the hypergeometric function $_2F_1(a,b,x)$. 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 $|x|<1$.

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

hypot($x,y$)
The hypot($x,y$) function returns the quadrature sum of $x$ and $y$, $\sqrt {x^2+y^2}$, where $x$ and $y$ may have any physical dimensions so long as they match, and can be complex numbers.

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

int_dx($e,min,max$)
The int_dx($e,min,max$) function numerically integrates an expression $e$ with respect to $x$ between $min$ and $max$. ‘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 $e$ may optionally be enclosed in quotes. $min$ and $max$ 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 $x^2$ with respect to $x$ between $1$ m and $2$ m:
print int_dx("x**2", 1*unit(m), 2*unit(m)).

jacobi_cn($u,m$)
The jacobi_cn($u,m$) function evaluates a Jacobi elliptic function; it returns the value $\cos \phi $ where $\phi $ is defined by the integral

  \[  \int _{0}^{\phi }\frac{\mathrm{d}\theta }{\sqrt {1-m\sin ^2\theta }}. \]    

jacobi_dn($u,m$)
The jacobi_dn($u,m$) function evaluates a Jacobi elliptic function; it returns the value $\sqrt {1-m\sin ^2\theta }$ where $\phi $ is defined by the integral

  \[  \int _{0}^{\phi }\frac{\mathrm{d}\theta }{\sqrt {1-m\sin ^2\theta }}. \]    

jacobi_sn($u,m$)
The jacobi_sn($u,m$) function evaluates a Jacobi elliptic function; it returns the value $\sin \phi $ where $\phi $ is defined by the integral

  \[  \int _{0}^{\phi }\frac{\mathrm{d}\theta }{\sqrt {1-m\sin ^2\theta }}. \]    

lambert_W0($x$)
The lambert_W0($x$) function evaluates the principal real branch of the Lambert W function, for which $W>-1$ when $x<0$.

lambert_W1($x$)
The lambert_W1($x$) function evaluates the secondary real branch of the Lambert W function, for which $W<-1$ when $x<0$.

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

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

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

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

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

lognormalCDF($x,\zeta ,\sigma $)
The lognormalCDF($x,\zeta ,\sigma $) function evaluates the log normal cumulative distribution function of standard deviation $\sigma $, centred upon $\zeta $, at $x$. $\sigma $ must be real, positive and dimensionless. $x$ and $\zeta $ must both be real, but may have any physical dimensions so long as they match.

lognormalCDFi($x,\zeta ,\sigma $)
The lognormalCDFi($x,\zeta ,\sigma $) function evaluates the inverse log normal cumulative distribution function of standard deviation $\sigma $, centred upon $\zeta $, at $x$. $\sigma $ must be real, positive and dimensionless. $x$ and $\zeta $ must both be real, but may have any physical dimensions so long as they match.

lognormalPDF($x,\zeta ,\sigma $)
The lognormalPDF($x,\zeta ,\sigma $) function evaluates the log normal probability density function of standard deviation $\sigma $, centred upon $\zeta $, at $x$. $\sigma $ must be real, positive and dimensionless. $x$ and $\zeta $ must both be real, but may have any physical dimensions so long as they match.

max($x,y$)
The max($x,y$) function returns the greater of the two values $x$ and $y$, where $x$ and $y$ may have any physical dimensions so long as they match. If either input is complex, the input with the larger magnitude is returned.

min($x,y$)
The min($x,y$) function returns the lesser of the two values $x$ and $y$, where $x$ and $y$ may have any physical dimensions so long as they match. If either input is complex, the input with the smaller magnitude is returned.

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

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

poissonCDF($x,\mu $)
The poissonCDF($x,\mu $) function returns the probability of getting $\leq x$ from a Poisson distribution with mean $\mu $, where $\mu $ must be real, positive and dimensionless and $x$ must be real and dimensionless.

poissonPDF($x,\mu $)
The poissonPDF($x,\mu $) function returns the probability of getting $x$ from a Poisson distribution with mean $\mu $, where $\mu $ must be real, positive and dimensionless and $x$ must be a real dimensionless integer.

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

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

radians($x$)
The radians($x$) 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 $x$.

random()
The random() function returns a random real number between 0 and 1.

random_­binomial($p,n$)
The random_­binomial($p,n$) function returns a random sample from a binomial distribution with $n$ independent trials and a success probability $p$. $n$ must be a real positive dimensionless integer. $p$ must be a dimensionless number in the range $0\leq p\leq 1$.

random_­chisq($\nu $)
The random_­chisq($\nu $) function returns a random sample from a $\chi $-squared distribution with $\nu $ degrees of freedom, where $\nu $ must be a real positive dimensionless integer.

random_­gaussian($\sigma $)
The random_­gaussian($\sigma $) function returns a random sample from a Gaussian (normal) distribution of standard deviation $\sigma $ and centred upon zero. $\sigma $ must be real, but may have any physical units. The returned random sample shares the physical units of $\sigma $.

random_­lognormal($\zeta ,\sigma $)
The random_­lognormal($\zeta ,\sigma $) function returns a random sample from the log normal distribution centred on $\zeta $, and of width $\sigma $. $\sigma $ must be a real positive dimensionless number. $\zeta $ must be real, but may have any physical units. The returned random sample shares the physical units of $\zeta $.

random_­poisson($n$)
The random_­poisson($n$) function returns a random integer from a Poisson distribution with mean $n$, where $n$ must be a real positive dimensionless number.

random_­tdist($\nu $)
The random_­tdist($\nu $) function returns a random sample from a $t$-distribution with $\nu $ degrees of freedom, where $\nu $ must be a real positive dimensionless integer.

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

root($z,n$)
The root($z,n$) function returns the $n$th root of $z$. $z$ may be any complex number, and may have any physical dimensions. $n$ must be a dimensionless integer. When complex arithmetic is enabled, and whenever $z$ is positive, this function is entirely equivalent to pow(z,1/n). However, when $z$ 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 $1/n$. The expression root(z,n), on the other hand, may be evaluated under such conditions, providing that $n$ is an odd integer.

sec($z$)
The sec($z$) function returns the secant of $z$, where $z$ 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($z$)
The sech($z$) function returns the hyperbolic secant of $z$, where $z$ 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.

sin($z$)
The sin($z$) function returns the sine of $z$, where $z$ 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($z$)
The sinc($z$) function returns the sinc function $\sin (z)/z$ for any complex number $z$, 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($z$)
The sinh($z$) function returns the hyperbolic sine of $z$, where $z$ 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($z$)
The sqrt($z$) function returns the square root of $z$, which may be any complex number and may have any physical dimensions.

strcmp($s1,s2$)
The strcmp($s1,s2$) function returns zero if the strings $s1$ and $s2$ are the same, one if $s1$ should be placed after $s2$ in alphabetical sequence, minus one if $s1$ should be placed before $s2$ in alphabetical sequence.

strlen($s$)
The strlen($s$) function returns the length of the string $s$.

strlower($s$)
The strlower($s$) function returns a version of the string $s$ in which all alphabetic characters are converted to lowercase.

strrange($s,i,j$)
The strrange($s,i,j$) function returns a slice of the string $s$ containing only the $i$th through until the $j$th characters of the string. If either $i$ or $j$ are negative, they are counted from the end of the string; for example, $-1$ refers to the last character of the string.

strupper($s$)
The strupper($s$) function returns a version of the string $s$ in which all alphabetic characters are converted to uppercase.

tan($z$)
The tan($z$) function returns the tangent of $z$, where $z$ 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($z$)
The tanh($z$) function returns the hyperbolic tangent of $z$, where $z$ 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.

tdistCDF($x,nu$)
The tdistCDF($x,nu$) function returns the cumulative probability density at $x$ in a $t$-distribution with $\nu $ degrees of freedom. $\nu $ must be a positive real dimensionless integer. $x$ must be a positive real dimensionless number.

tdistCDFi($P,nu$)
The tdistCDFi($P,nu$) function returns the point $x$ at which the cumulative probability density in a $t$-distribution with $\nu $ degrees of freedom is $P$. $\nu $ must be a positive real dimensionless integer. $P$ must be a real number in the range $0\leq p \leq 1$.

tdistPDF($x,nu$)
The tdistPDF($x,nu$) function returns the probability density at $x$ in a $t$-distribution with $\nu $ degrees of freedom. $\nu $ must be a positive real dimensionless integer. $x$ must be a positive real dimensionless number.

texify(…)
The texify(…) function returns a string of LaTeX text corresponding to the algebraic expression or string supplied between the brackets.

time_­daymonth(JD)
The time_­daymonth(JD) function returns the number of the day of the month on which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­dayweekname(JD)
The time_­dayweekname(JD) function returns as a string the name of the day of the week on which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­dayweeknum(JD)
The time_­dayweeknum(JD) function returns the number, in the range 1 (Sunday) to 7 (Saturday), of the day of the week on which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­diff(JD$_1$JD$_2$)
The time_­diff(JD$_1$JD$_2$) function returns the time interval elapsed between the first and second supplied Julian Day numbers. For more details see the time_­julianday() function.

time_­diff_­string(JD$_1$JD$_2$format)
The time_­diff_­string(JD$_1$JD$_2$format) function returns a string representation of the time interval elapsed between the first and second supplied Julian Day numbers. For more details about Julian Day numbers, see the time_­julianday() function. The third input is used to control the format of the output, with the following tokens being substituted for:

Token

Value

%%

A literal % sign.

%d

The number of days elapsed, modulo 365.

%D

The number of days elapsed.

%h

The number of hours elapsed, modulo 24.

%H

The number of hours elapsed.

%m

The number of minutes elapsed, modulo 60.

%M

The number of minutes elapsed.

%s

The number of seconds elapsed, modulo 60.

%S

The number of seconds elapsed.

%Y

The number of years elapsed.

time_­fromunix(u)
The time_­fromunix(u) function returns the Julian Day number corresponding to the specified Unix time $u$.

time_­hour(JD)
The time_­hour(JD) function returns the integer hour of the day, in the range 0-23, in which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­julianday(yearmonthdayhourminsec)
The time_­julianday(yearmonthdayhourminsec) function returns the Julian Day number corresponding to the supplied time and date. Each field should be supplied numerically as an integer: for example, the month argument should be an integer in the range 1-12. In the default British calendar, the year argument should be the number of years elapsed since the Christian epoch. To enter dates before AD 1, $0$ should be passed to indicate the year 1 BC, $-1$ should be passed to indicate the year 2 BC, and so forth. Dates may be entered in other calendars using the set calendar command.

Julian Day numbers are defined to be the number of days elapsed since noon on 1st January, 4713 BC in the Julian Calendar. Consequently, Julian Day numbers are rather large numbers: for example, midnight on 1st January 2000 corresponds to the Julian Day number 2451544.5. The hour of the day is indicated by the fractional part of the Julian Day number.

Julian Day numbers provide a useful means for analysing time-series data because they are not subject to the complicated non-decimal units in which time is conventionally measured. The task of calculating the time interval elapsed between two calendar dates is in general rather difficult, especially when leap years need be considered. However, the number of 24-hour periods elapsed between two Julian Day numbers is simply the numerical difference between the two day numbers.

PyXPlot’s implementation of the time_­julianday() function includes a consideration of the transition which was made from the Julian calendar to the Gregorian calendar on various dates in various countries. By default the transition is made at midnight on 14th September 1752 (Gregorian calendar), when Britain and the British Empire adopted the Gregorian calendar. However, this may be changed using the set calendar command.

time_­min(JD)
The time_­min(JD) function returns the integer number of minutes elapsed within the hour when the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­monthname(JD)
The time_­monthname(JD) function returns as a string the English name of the calendar month in which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­monthnum(JD)
The time_­monthnum(JD) function returns the number, in the range 1-12, of the calendar month in which the supplied Julian Day number falls. For more details see the time_­julianday() function.

time_­now()
The time_­now() function returns the Julian Day number corresponding to the present epoch. For more details see the time_­julianday() function.

time_­sec(JD)
The time_­sec(JD) function returns the number of seconds elapsed within the minute when the supplied Julian Day number falls. The number of seconds includes the fractional part. For more details see the time_­julianday() function.

time_­string(JDformat)
The time_­string(JDformat) function returns a string representation of the date and time corresponding to the supplied Julian Day number. For more details about Julian Day numbers, see the time_­julianday() function. The second input is optional, and may be used to control the format of the output. If no format string is provided, then the format
"%a %Y %b %d %H:%M:%S"
is used. In such format strings, the following tokens are substituted for various parts of the date:

Token

Value

%%

A literal % sign.

%a

Three-letter abbreviated weekday name.

%A

Full weekday name.

%b

Three-letter abbreviated month name.

%B

Full month name.

%C

Century number, e.g. 21 for the years 2000-2100.

%d

Day of month.

%H

Hour of day, in range 00-23.

%I

Hour of day, in range 01-12.

%k

Hour of day, in range 0-23.

%l

Hour of day, in range 1-12.

%m

Month number, in range 01-12.

%M

Minute, in range 00-59.

%p

Either am or pm.

%S

Second, in range 00-59.

%y

Last two digits of year number.

%Y

Year number.

time_­unix(JD)
The time_­unix(JD) function returns the Unix time corresponding to the specified Julian Day number.

time_­year(JD)
The time_­year(JD) function returns the year in which the supplied Julian Day number falls. For more details see the time_­julianday() function. The returned value is a dimensionless integer. A value of $0$ corresponds to the year 1 BC; a value of $-1$ corresponds to the year 2 BC, and so forth.

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

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).

zernike($n,m,r,\phi $)
The zernike($n,m,r,\phi $) function evaluates the Zernike polynomial $Z^ m_ n(r,\phi )$, where $m$ and $n$ are non-negative integers with $n\geq m$, $r$ is the radial coordinate in the range $0<r<1$ and $\phi $ is the azimuthal coordinate.

zernikeR($n,m,r$)
The zernikeR($n,m,r$) function evaluates the radial Zernike polynomial $R^ m_ n(r)$, where $m$ and $n$ are non-negative integers with $n\geq m$ and $r$ is the radial coordinate in the range $0<r<1$.

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