33math Module
33.1Overview
The math
module provices functions for mathematical calculation. This is a built-in module, so you can use it without being imported.
33.2Module Function
math.abs(num):map
math.acos(num):map:[deg]
Returns an inverse cosine value.
In default, the result is returned in radian. Specifying an attribute :deg
would return that in degree.
math.arg(num):map:[deg]
Returns an argument, an angle from the real-axis in the complex plane, of a complex number.
In default, the angle value is returned in radian. Specifying an attribute :deg
would return that in degree.
math.asin(num):map:[deg]
Returns an inverse sine value.
In default, the result is returned in radian. Specifying an attribute :deg
would return that in degree.
math.atan(num):map:[deg]
math.atan2(num1, num2):map:[deg]
Returns an inverse tangent value of a fraction of num1 and num2.
In default, the result is returned in radian. Specifying an attribute :deg
would return that in degree.
math.bezier(nums[]+:number)
math.ceil(num):map
math.conj(num):map
math.cos(num):map:[deg]
Returns a cosine value.
In default, the given argument is treated as a radian number. Specifying an attribute :deg
would treat that as a degree number.
math.cosh(num):map
math.covariance(a, b)
a
and b
.
math.cross (a, b)
a
and b
.
math.delta(num):map
num
that returns 1
when num == 0
and 0
otherwise.
math.diff(expr:expr, var:symbol):map {block?}
Calculates a mathematical differential expression of the given expr
by a variable var
.
If block
is specified, it would be evaluated with a block parameter |rtn:expr|
, where rtn
is the created instance. In this case, the block's result would become the function's returned value.
Example: math.diff(
(math.sin(x 2)), x)
**
math.dot(a, b)
a
and b
.
math.exp(num):map
math.fft(seq[])
math.floor(num):map
math.gcd(a:number, b+:number):map
math.hypot(x, y):map
math.imag(num):map
math.integral()
math.lcm(a:number, b+:number):map
math.least_square(x:iterator, y:iterator, dim:number => 1, var:symbol => `x)
x
and y
that return coordinate of points and returns a function that fits them using least square metho. You can specify the fitting curve's dimension by an argument dim
, which default value is one. The variable symbol used in the function is x
, which can be changed by specifying an argument var
.
math.log(num):map
math.log10(num):map
math.norm(num):map
math.optimize(expr:expr):map {block?}
Returns an optimized expression of the given argument expr
, which needs to be made up of mathematical elements.
If block
is specified, it would be evaluated with a block parameter |rtn:expr|
, where rtn
is the created instance. In this case, the block's result would become the function's returned value.
math.real(num):map
math.relu(num):map
num
that returns num
when num >= 0
and 0
otherwise.
math.sin(num):map:[deg]
Returns a sine value.
In default, the given argument is treated as a radian number. Specifying an attribute :deg
would treat that as a degree number.
math.sinh(num):map
math.sqrt(num):map
math.tan(num):map:[deg]
Returns a tangent value.
In default, the given argument is treated as a radian number. Specifying an attribute :deg
would treat that as a degree number.
math.tanh(num):map
math.unitstep(num):map
num
that returns 1
when num >= 0
and 0
otherwise.