# Python math module | Python import math | Function | Operators

Python maths module is a standard module and is always available in python to do mathematical operations easily. To Import math in python is to give access to the mathematical functions, which are defined by the C standard. In this tutorial, you will learn about some important math module functions with examples in python.

To use Python math functions, you have to import the module using the import math line at the starting of the program to get the math class object. Using a math class object can access any math function in python.

What is a module? Must read this tutorial – Python Modules | Import Custom and Built-in.

This tutorial, you will learn How to python import math and use with Latest examples.

Note: The functions under the math module do not support a complex number or you can’t use. For use a complex number with this function you have to use other modules in python.

### Syntax

A Simple syntax of Python import math.

```#get pi value
import math
math.pi```

## Let’s see an example of math function

Once you have done the Python import math module, then you can access modules function like the `math.sqrt(value)` – square root of the number. It returns a float number value.

See this example how to use match square root function in python. We doing for value 25, so output should be 5.

```import math

# Square root of number
sqrValue = math.sqrt(25)
print(sqrValue)```

Output: 5.0

### Some Functions in Python Math Module

If we are trying to cover all functions in python math module, then the list is very long. Python separated in math functions in a group, here it is –

• Number-theoretic and representation functions
• Power and logarithmic functions
• Trigonometric functions
• Angular conversion
• Hyperbolic functions
• Special functions
• Constants

Every group has many functions so, Let’s see some important math functions. For a complete list of a function, you can read it on the official site, mentioned at the end of the tutorial.

### Example of some math functions

These are some example code of Python math function, so you can learn to teach you how you can use math function.

```# Math module functions

import math

sqrValue = math.pow(25.3, 2)
print("pi: ", math.pi)
print("pow: ", math.pow(3, 2))
print("ceil: ", math.ceil(7.24))
print("floor: ", math.floor(7.24))
print("sqrt: ", math.sqrt(9))
print("sin", math.sin(90))
print("cos", math.cos(90))
print("tan", math.tan(90))```

#### Output screenshot:

In the example used many operators, so for Python math operators operations must read this tutorial – Python Operators Overview with Examples

Do comment if any doubt, suggestion or examples you have.

Note: This example (Project) is developed in PyCharm 2018.2 (Community Edition)
JRE: 1.8.0
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Python 3.7

All Python maths module, Function and import examples are in Python 3, so it may change its different from python 2 or upgraded versions.