Learn Python
WIP Playing with Numbers

WIP - Math Module

In order to perform mathematical functions, python has a built-in module math with all the mathematical functions. To use this module Some of the functions are: Factorial of a number = factorial(number) To find the absolute value of a number = fabs(number) To find the square root of a number = sqrt(number) To use these functions the math module has to be imported using the statement import math. This is illustrated in the example below.

In the below example we find the factorial of 5, the absolute value of -5.345, square root of 49.

It supports all the trigonometric functions like sin, cos, tan, tanh, sinh, cosh, and so on. In this example, we are finding the sin, oos, tan, tanh, sinh, cosh of 90

math module also has mathematical constants like pi, e, and so on. In this example, we are printing the values of pi and e.

Along with these functions the math module consists of all the logarithimic functions, angle conversion functions and representation functions