The Math Module
Mathematic functions are often described as a black box which maps an input set X to an output set Y:

The
mathmodule allows you to use mathematic functions. You need to firstly import the module:import mathTo use the functions defined within the math module, you can use the “dot” (
.) to access a function:math.cos(0)There exists many useful functions performing math operations that we will be using in this course:
- If you intend on using a particular function or constant often, you can import only what you are interested in, and you won’t need to type math. before its name: