What is the difference between the math and cmath modules?

2

In Python we realize that there are the following modules: math and cmath , however I did not understand what difference between the two. Here's how they can be imported:

import math
import cmath

What differences between modules math and cmath ?

    
asked by anonymous 01.02.2017 / 18:28

2 answers

5

As described in documentation , the cmath " module provides access to the functions mathematics for complex numbers ". In fact the functions of this module also accept integers and real numbers, besides allowing to work with complex numbers. However, the "normal" functions of the math module can not be used with complex numbers.

    
01.02.2017 / 18:31
6
  • math is the mathematical functions module.

  • cmath is the module of mathematical functions that work with complex numbers.

01.02.2017 / 18:32