Next Previous Up Contents
Next: Shapes
Up: Functions
Previous: Lists

#### 10.6.13 Maths

Standard mathematical and trigonometric functions. Trigonometric functions work with angles in radians.

`sin( theta )`
  Sine of an angle.

  - Parameters:
    - `theta` (floating point): an angle, in radians.
  - Return value
    - (floating point): the sine of the argument.
`cos( theta )`
  Cosine of an angle.

  - Parameters:
    - `theta` (floating point): an angle, in radians.
  - Return value
    - (floating point): the cosine of the argument.
`tan( theta )`
  Tangent of an angle.

  - Parameters:
    - `theta` (floating point): an angle, in radians.
  - Return value
    - (floating point): the tangent of the argument.
`asin( x )`
  Arc sine of an angle. The result is in the range of -pi/2 through pi/2.

  - Parameters:
    - `x` (floating point): the value whose arc sine is to be returned.
  - Return value
    - (floating point): the arc sine of the argument (radians)
`acos( x )`
  Arc cosine of an angle. The result is in the range of 0.0 through pi.

  - Parameters:
    - `x` (floating point): the value whose arc cosine is to be returned.
  - Return value
    - (floating point): the arc cosine of the argument (radians)
`atan( x )`
  Arc tangent of an angle. The result is in the range of -pi/2 through pi/2.

  - Parameters:
    - `x` (floating point): the value whose arc tangent is to be returned.
  - Return value
    - (floating point): the arc tangent of the argument (radians)
`ln( x )`
  Natural logarithm.

  - Parameters:
    - `x` (floating point): argument
  - Return value
    - (floating point): loge(x)
`exp( x )`
  Euler's number e raised to a power.

  - Parameters:
    - `x` (floating point): the exponent to raise e to.
  - Return value
    - (floating point): the value ex, where e is the base of the natural logarithms.
`log10( x )`
  Logarithm to base 10.

  - Parameters:
    - `x` (floating point): argument
  - Return value
    - (floating point): log10(x)
`exp10( x )`
  Power of 10. This convenience function is identical to `pow(10,x)`.

  - Parameters:
    - `x` (floating point): argument
  - Return value
    - (floating point): 10x
`sqrt( x )`
  Square root. The result is correctly rounded and positive.

  - Parameters:
    - `x` (floating point): a value.
  - Return value
    - (floating point): the positive square root of `x`. If the argument is NaN or less than zero, the result is NaN.
`square( x )`
  Raise to the power 2.

  - Parameters:
    - `x` (floating point): a value
  - Return value
    - (floating point): x * x
`hypot( xs, ... )`
  Returns the square root of the sum of squares of its arguments. In the 2-argument case, doing it like this may avoid intermediate overflow or underflow.

  - Parameters:
    - `xs` (floating point, one or more): one or more numeric values
  - Return value
    - (floating point): sqare root of sum of squares of arguments
  - Examples:
    - `hypot(3,4) = 5`
    - `hypot(2,2,2,2) = 4`
`atan2( y, x )`
  Converts rectangular coordinates (`x`,`y`) to polar (`r`,`theta`). This method computes the phase `theta` by computing an arc tangent of `y/x` in the range of -pi to pi.

  - Parameters:
    - `y` (floating point): the ordinate coordinate
    - `x` (floating point): the abscissa coordinate
  - Return value
    - (floating point): the `theta` component (radians) of the point (`r`,`theta`) in polar coordinates that corresponds to the point (`x`,`y`) in Cartesian coordinates.
`pow( a, b )`
  Exponentiation. The result is the value of the first argument raised to the power of the second argument.

  - Parameters:
    - `a` (floating point): the base.
    - `b` (floating point): the exponent.
  - Return value
    - (floating point): the value `ab`.
`sinh( x )`
  Hyperbolic sine.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`cosh( x )`
  Hyperbolic cosine.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`tanh( x )`
  Hyperbolic tangent.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`asinh( x )`
  Inverse hyperbolic sine.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`acosh( x )`
  Inverse hyperbolic cosine.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`atanh( x )`
  Inverse hyperbolic tangent.

  - Parameters:
    - `x` (floating point): parameter
  - Return value
    - (floating point): result
`E`
  Euler's number e, the base of natural logarithms.

`PI`
  Pi, the ratio of the circumference of a circle to its diameter.

`Infinity`
  Positive infinite floating point value.

`NaN`
  Not-a-Number floating point value. Use with care; arithmetic and logical operations behave in strange ways near NaN (for instance, `NaN!=NaN`). For most purposes this is equivalent to the blank value.

`RANDOM`
  Evaluates to a random number in the range 0<=x<1. This is different for each cell of the table. The quality of the randomness may not be particularly good.

Next Previous Up Contents
Next: Shapes
Up: Functions
Previous: Lists

STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note256
STILTS web page: http://www.starlink.ac.uk/stilts/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@jiscmail.ac.uk