2.4 Operators and Functions

As has already been seen above, some mathematical functions such as $\sin (x)$ are pre-defined within PyXPlot. A list of frequently-used functions which are predefined in PyXPlot is given in Table 2.1Users with some experience in Python may be interested to know that all of the functions in the core and math modules are recognised.. A list of operators recognised by PyXPlot is given in Table 2.2.

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.

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.

frexp($x$)

Return the mantissa and exponent of $x$, as pair $(m,e)$. $m$ is a float and $e$ is an int, such that $x = m \times 2^ e$. If $x$ is 0, $m$ and $e$ are both 0. Else $0.5 \leq \mathrm{abs}(m) < 1.0$.

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.

modf($x$)

Return the fractional and integer parts of $x$. Both results carry the sign of $x$. The integer part is returned as a real.

pow($x,y$)

Return $x^ y$.

radians($x$)

Converts angle $x$ from degrees to radians.

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.1: A list of mathematical functions which are pre-defined within PyXPlot.

+

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.2: A list of mathematical operators which PyXPlot recognises.