math-simple
module reference
math-simple
module reference
Mathematical functions for scalars.
All operators are PureOps.
They accept only scalar numbers.
For vectorized operators and matrix multiplication, use math
.
index
- alias of
mod
- alias of
mul
- alias of
add
- alias of
sub
- alias of
div
- alias of
idiv
- alias of
pow
- Get the absolute value.
- Inverse cosine function (radians).
- Add values.
- Inverse sine function (radians).
- Inverse tangent function (radians).
- Inverse tangent function (two argument version).
- Round towards positive infinity.
- Clamp a value to a range.
- Cosine function (radians).
- Hyperbolic cosine function (radians).
- Decrement by 1.
- Divide values.
- Check whether val is even.
- *e* number raised to a power.
- Round towards negative infinity.
- Positive infinity constant.
- Divide values and floor.
- Increment by 1.
- Logarithm with optional base.
- Logarithm with base 10.
- Find the maximum.
- Find the minimum.
- Linearly interpolate.
- Modulo operator.
- Multiply values.
- Check whether val is odd.
- The pi constant.
- Raise to a power.
- Sine function (radians).
- Hyperbolic sine function (radians).
- Square root function.
- Subtract values.
- Tangent function (radians).
- Hyperbolic tangent function (radians).
- The tau constant.
details
- Get the absolute value.
(abs val)
- Inverse cosine function (radians).
(acos cos)
- Add values.
(+ a b [c…])
(add a b [c…])
Sum all arguments.
- Inverse sine function (radians).
(asin sin)
- Inverse tangent function (radians).
(atan tan)
- Inverse tangent function (two argument version).
(atan2 y x)
- Round towards positive infinity.
(ceil val)
- Clamp a value to a range.
(clamp min max val)
Returns
min
ifval < min
;max
ifval > max
; andval
otherwise. - Cosine function (radians).
(cos alpha)
- Hyperbolic cosine function (radians).
(cosh alpha)
- Decrement by 1.
(dec i)
- Divide values.
(/ a b [c…])
(div a b [c…])
Divide
a
by all other arguments. - Check whether val is even.
(even val [div])
true
if dividingval
bydiv
has remainder zero.div
defaults to 2. - *e* number raised to a power.
(exp exp)
- Round towards negative infinity.
(floor val)
- Positive infinity constant.
- Divide values and floor.
(// a b [c…])
(idiv a b [c…])
Divide
a
by all other arguments, flooring each time. - Increment by 1.
(inc i)
- Logarithm with optional base.
(log val [base])
- Logarithm with base 10.
(log10 val)
- Find the maximum.
(max a b [c…])
Return the highest of arguments.
- Find the minimum.
(min a b [c…])
Return the lowest of arguments.
- Linearly interpolate.
(mix a b i)
Interpolate between
a
andb
usingi
in range 0-1. - Modulo operator.
(% num div)
(mod num div)
Calculate remainder of division by
div
. - Multiply values.
(* a b [c…])
(mul a b [c…])
- Check whether val is odd.
(odd val [div])
true
if dividingval
bydiv
has remainder one.div
defaults to 2. - The pi constant.
- Raise to a power.
(^ base exp)
(pow base exp
Raise
base
to the powerexp
. - Sine function (radians).
(sin alpha)
- Hyperbolic sine function (radians).
(sinh alpha)
- Square root function.
(sqrt val)
- Subtract values.
(- a b [c…])
(- b)
(sub a b [c…])
Subtract all other arguments from
a
.If only
b
is given,a
is assumed to be0
. - Tangent function (radians).
(tan alpha)
- Hyperbolic tangent function (radians).
(tanh alpha)
- The tau constant.