# Python Math Module

Python have 5 built-in data types one of which is Numbers which can be integer(10, 29, -10), Floats(19.29, -29.12) or even complex( 20 + 28i ). Although there are some common mathematical functions built into language itself. But there does exist a specific Module containing many functions to do Mathematical Operations on Numbers data types in Python – Math Python Module.

First question would be How to import Math module in Python? You can import python’s math module into code by using import math statement and to access functions inside it do math.function_name(parameter). Like math.ceil(19.29).

Below are some tables explaining what are functions inside Math module with some examples for each.

## Examples of using Math Module in Python Code

``````# import math module
import math

# Print out Mathematical Exponent, Pie constant
print(math.e)
print(math.pi)

# Above code prints out
2.718281828459045
3.141592653589793``````

## Numaric Functions Inside Python Math Module

Table containing numerical functions inside Math Python Module with description and examples for each one.

## Logarithmic Functions inside Python Math Module

Table containing logarithmic functions inside Math Python Module with description and examples for each one.

## Trigonometric Functions in Python Math Module

Table containing logarithmic functions inside Math Python Module with description and examples for each one.

Stop 🖐🏻
If your unaware of What are trigonometric functions? then see – Mathematical Trigonometric Functions first.

Python deals with Trigonometric functions like Sine, Cosine and others in Radians not in degrees. If in case your unaware of What is Radian? then see Radian first before moving on further in this article.

## Angular Conversion functions in Python Math Module

Table containing Angular Conversion functions(For converting degrees to radians and vice-versa) with description and examples for each one.

## Mathematical Constants in Python Math Module

Tables containing Mathematical Constants with description and examples for each one.

## Conclusion

Python’s Data Type Number can be integer, float or complex. But all of functions in Python’s Math Module can be applied to only integers/floats but can’t be applied to complex numbers as these have an imaginary part called iota.
That’s why Complex Numbers are totally different from others, so in order to do Mathematics with these numbers Python’s core developers have designed a separate module containing all functions which can take in complex numbers as parameter.
See this – cmath Python Module for Complex Numbers

Moreover if your interested in learning more about Python Programming Language, then you can see other articles written by me about Python here – Computer Science Hub Python.

Josh

Hi, I'm Josh a Computer Science graduate from California State University, Sacramento since coming out with my Master's from university. I've worked with multiple startups across US and in UK as well primarily as a Python Developer. Here on this website, I'm sharing my knowledge of Python. If you want to ask me anything about Python feel free to reach out, I would be happy to help you out.