-
Notifications
You must be signed in to change notification settings - Fork 1
Math
Jean Dubois edited this page Apr 27, 2024
·
8 revisions
The math
module can be imported with the statement import math
.
The math
module is used to do math. To do statistics, use the statistics
module.
-
math.sqrt(number)
: calculates the square root of a number n.$n \in \mathbb{R}_+$ -
math.isqrt(number)
: calculates the integer square root of a number n.$n \in \mathbb{N}$ -
math.root(number, k)
: calculates the k root of a number n.$n \in \mathbb{R}_+, k \in \mathbb{R}$ -
math.iroot(number, k)
: calculates the k root of a number n.$n \in \mathbb{R}_+, k \in \mathbb{R}$ -
math.degrees(angle)
: transform a radian angle to a degree angle.$angle \in \mathbb{R}$ -
math.radians(angle)
: transform a degree angle to a radian angle.$angle \in \mathbb{R}$ -
math.sin(angle)
: calculates sine of an angle in radians.$angle \in \mathbb{R}$ -
math.cos(angle)
: calculates cosine of an angle in radians.$angle \in \mathbb{R}$ -
math.tan(angle)
: calculates tangent of an angle in radians.$angle \in \mathbb{R}$ -
math.asin(sin)
: calculates arcsine of an sin (result in radians).$sin \in [-1, 1]$ -
math.acos(cos)
: calculates arccosine of an cos (result in radians).$cos \in [-1, 1]$ -
math.atan(tan)
: calculates arctangent of an tan (result in radians).$tan \in \mathbb{R}$ -
math.abs(number)
: calculates absolute value of number.$n \in \mathbb{R}$ -
math.log(number, base)
: calculates natural logarithm of a number if no base given, or logarithm of a number in the given baser.$n, base \in \mathbb{R}$ -
math.log2(number)
: same asmath.log(number, 2)
.$n \in \mathbb{R}$ -
math.factorial(number)
(new in 0.19.0-beta): calculates the factorial of a number.$n \in \mathbb{N}$
-
math.pi
: Pi.$3.141592653589793$ -
math.tau
: Tau.$6.283185307179586$ -
math.sqrt_pi
: square root of pi (math.sqrt(math.pi)
).$1.7724538509055159$ -
math.sqrt_tau
: square root of tau (math.sqrt(math.tau)
).$2.5066282746310002$ -
math.e
: Euler's number.$2.718281828459045$