Top Documents Download Gallery Repository
Are you looking for a Software Engineer? Check Here

32math Module

The math module provices functions for mathematical calculation. This is a built-in module, so you can use it without being imported.

32.1Module Function

math.abs
math.abs(num):map
Returns an absolute value.

math.acos
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
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
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
math.atan(num):map:[deg]
Returns an inverse tangent value.

math.atan2
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
math.bezier(nums[]+:number)
Returns a list that consists of functions that generate coordinates of bezier curves with specified control points. One or more lists of control points can be specified. This means that if you give it two lists of numbers as arguments, it returns two functions of bezier curve.

math.ceil
math.ceil(num):map
Returns a nearest integer number above or equal to the specified value.

math.conj
math.conj(num):map
Returns a conjugate of a complex number.

math.cos
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
math.cosh(num):map
Returns a hyperbolic cosine value.

math.covariance
math.covariance(a, b)
Returns a covariance between the a and b.

math.cross
math.cross (a, b)
Calculates a cross product between a and b.

math.delta
math.delta(num):map
Evaluates a delta function with a given argument num that returns 1 when num == 0 and 0 otherwise.

math.diff
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
math.dot(a, b)
Calculates a dot product between a and b.

math.exp
math.exp(num):map
Returns an exponential value.

math.fft
math.fft(seq[])

math.floor
math.floor(num):map
Returns a nearest integer number below or equal to the specified value.

math.gcd
math.gcd(a:number, b+:number):map
Returns a greatest common divisor among two or more numbers.

math.hypot
math.hypot(x, y):map
Returns a hyperbolic tangent value.

math.imag
math.imag(num):map
Returns an imaginary part of a complex number.

math.integral
math.integral()

math.lcm
math.lcm(a:number, b+:number):map
Returns a least common multiple among two or more numbers.

math.least_square
math.least_square(x:iterator, y:iterator, dim:number => 1, var:symbol => `x)
Takes two iterators 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
math.log(num):map
Returns a natural logarithm value.

math.log10
math.log10(num):map
Returns a decadic logarithm value.

math.norm
math.norm(num):map
Returns a norm value of a complex number.

math.optimize
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.ramp
math.ramp(num):map
Evaluates a ramp function with a given argument num that returns num when num >= 0 and 0 otherwise.

math.real
math.real(num):map
Returns a real part of a complex number.

math.sin
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
math.sinh(num):map
Returns a hyperbolic sine value.

math.sqrt
math.sqrt(num):map
Returns a square root value.

math.tan
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
math.tanh(num):map
Returns a hyperbolic tangent value.

math.unitstep
math.unitstep(num):map
Evaluates a unit step function with a given argument num that returns 1 when num >= 0 and 0 otherwise.


Copyright (C) 2011-2017 ypsitau