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):mapmath.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):mapmath.conj(num):mapmath.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):mapmath.covariance(a, b)a and b.
math.cross (a, b)a and b.
math.delta(num):mapnum 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):mapmath.fft(seq[])math.floor(num):mapmath.gcd(a:number, b+:number):mapmath.hypot(x, y):mapmath.imag(num):mapmath.integral()math.lcm(a:number, b+:number):mapmath.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):mapmath.log10(num):mapmath.norm(num):mapmath.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):mapmath.relu(num):mapnum 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):mapmath.sqrt(num):mapmath.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):mapmath.unitstep(num):mapnum that returns 1 when num >= 0 and 0 otherwise.