2.5 Operators and Functions

As has already been seen above, some mathematical functions such as $\sin (x)$ are pre-defined within PyXPlot. A list of all of PyXPlot’s pre-defined functions is given in Table 2.1. A list of operators recognised by PyXPlot is given in Table 2.3.

acos($x$)

Return the arc cosine (measured in radians) of $x$.

asin($x$)

Return the arc sine (measured in radians) of $x$.

atan($x$)

Return the arc tangent (measured in radians) of $x$.

atan2($y,x$)

Return the arc tangent (measured in radians) of $y/x$. Unlike $\mathrm{atan}(y/x)$, the signs of both $x$ and $y$ are considered.

ceil($x$)

Return the ceiling of $x$ as a float. This is the smallest integral value $\geq x$.

cos($x$)

Return the cosine of $x$ (measured in radians).

cosh($x$)

Return the hyperbolic cosine of $x$.

degrees($x$)

Convert angle $x$ from radians to degrees.

erf($x$)

Return the error function, i.e. the Gaussian (normal) distribution function.

exp($x$)

Return $e$ raised to the power of $x$.

fabs($x$)

Return the absolute value of the float $x$.

floor($x$)

Return the floor of $x$ as a float. This is the largest integral value $\leq x$.

fmod($x,y$)

Return fmod(x, y), according to platform C. x % y may differ.

gamma($x$)

Return the gamma function.

hypot($x,y$)

Return the Euclidean distance, $\sqrt {x^2 + y^2}$.

ldexp($x, i$)

Return $x \times 2^ i$.

log($x[,base]$)

Return the logarithm of $x$ to the given base. If the base not specified, returns the natural logarithm (base $e$) of $x$.

log10($x$)

Return the base 10 logarithm of $x$.

max($x$,$y$,...)

Return the greatest of the numerical values supplied.

min($x$,$y$,...)

Return the least of the numerical values supplied.

Table 2.1: A list of mathematical functions which are pre-defined within PyXPlot (cont’d. in Table 2.2).

pow($x,y$)

Return $x^ y$.

radians($x$)

Converts angle $x$ from degrees to radians.

random()

Return a pseudo-random number in the range $0\to 1$.

sin($x$)

Return the sine of $x$ (measured in radians).

sinh($x$)

Return the hyperbolic sine of $x$.

sqrt($x$)

Return the square root of $x$.

tan($x$)

Return the tangent of $x$ (measured in radians).

tanh($x$)

Return the hyperbolic tangent of $x$.

Table 2.2: A list of mathematical functions which are pre-defined within PyXPlot (cont’d. from Table 2.1).

+

Algebraic sum

-

Algebraic subtraction

*

Algebraic multiplication

**

Algebraic exponentiation

/

Algebraic division

%

Modulo operator

<<

Left binary shift

>>

Right binary shift

&

Binary and

|

Binary or

\^{}

Logical exclusive or

<

Magnitude comparison

>

Magnitude comparison

<=

Magnitude comparison

>=

Magnitude comparison

==

Equality comparison

!=

Equality comparison

<>

Alias for !=

and

Logical and

or

Logical or

Table 2.3: A list of mathematical operators which PyXPlot recognises.