Math Module
The math module can be imported with the name math
and has the following static properties:
PI
- Ratio of a circle's circumference to its diameter; approximately3.14159
E
- Euler's constant and the base of natural logarithms; approximately2.718
PHI
- Golden Ratio; approximately1.618
SQRT2
- Square root of 2; approximately1.414
The math module also has the following methods:
absolute(num)
- Returns the absolute value of a numberround(num)
- Returns the nearest integer to a numberfloor(num)
- Returns the largest integer less than or equal to a numberceil(num)
- Returns the smallest integer greater than or equal to a number
sin(num)
- Returns the sine of a numbercos(num)
- Returns the cosine of a numbertan(num)
- Returns the tangent of a numberasin(num)
- Returns the arcsine of a numberacos(num)
- Returns the arccosine of a numberatan(num)
- Returns the arctangent of a number
radtodeg(num)
- Converts a number in radians to degreesdegtorad(num)
- Converts a in degrees to radians
log([num], <root>)
- Returns the logarithm of a number to a specified base. If no base is provided, it will use the default log base,e
sqrt(num)
- Returns the square root of a numberpower([num], [exponent])
- Returns the value of a number raised to a specified powerroot([num], [root])
- Returns the root of a number to a specified root.
factorial(num)
- Returns the factorial of a numbermin([num, num...])
- Returns the minimum value of its inputsmax([num, num...])
- Returns the maximum value of its inputs