Cycles | Degrees | Radians |
---|---|---|
0 |
0 |
0 |
0.25 |
90 |
π/2 |
0.5 |
180 |
π |
0.75 |
270 |
3 π/2 |
1 |
360 |
2 π |
The math
modules provide the elementary functions. There are three variations to cope with the different conventions for expressing angles. For example,
use math: math_radians
selects the module that expresses angles in radians. So the trigonometric methods (math.arc_cosine
, math.arc_sine
, math.arc_tangent
, math.cosine
, math.sine
, and math.tangent
) express angles as radians. The descriptions in this section describe math_radians
.
Alternatively,
use math: math_degrees
selects the module that expresses angles as degrees, and
use math: math_cycles
selects the module that expresses angles as cycles.
math.arc_cosine(number)
Compute the arc cosine of a The number should
be between -1
and 1
. The result is the inverse cosine,
in radians, between 0
and 2
π.
math.arc_sine(number)
Compute the arc sine of a The number should be
between -1
and 1
. The result is the inverse sine,
in cycles, between neg(
π)
and π.
math.arc_tangent(
number,
denominator)
Compute the arc tangent of a If the optional denominator is supplied, then the value is obtained from number /
denominator, using the signs of both to determine the quadrant. The denominator is allowed to be 0
. The result is the inverse
tangent, in radians, between neg(
π)
and π.
math.cosine(number)
Compute the cosine. The number should be
in radians. The result is between -1
and 1
.
math.e(power | 1)
Compute the transcendental constant e raised to a power.
math.log(number
)
Compute the natural logarithm of the number.
math.log_ten(number
)
Compute the base-10 logarithm of the number.
math.log_two(number
)
Compute the base-2 logarithm of the number.
math.power(first, second)
Raise to a power.
math.root(radicand, number)
Take the root.
math.sine(number)
Compute the sine. The number should be in
radians. The result is the sine, between -1
and 1
.
math.sqrt(number
)
The square root of the number is computed.
Examples:
assign result: sqrt(256) # result is 16 assign result: sqrt(-1) # result is null
math.tangent(number)
Compute the tangent. The number should be in radians.