Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Similar to the random module, the “math” prefix has to be written to a function before it can be executed:

math.sin() math.cos() math.sqrt() math.exp()
math.tan() math.sinh() math.cosh() math.log()

 

The math module does not only provide trigonometric and power or logarithmic functions. There are also functions for angular conversions and the constants "Pi" and "e" included. For complex numbers you can call

...

If you have to load more than one module simply import them one after the other. With the PYTHONPATH environment variable it is also possible to specify additional search paths. This is useful for 3rd 3rd party Python modules, because they do not have to be installed under Python’s default directory, but can be anywhere on your hard disk. The creation/modification of environment variables is different for each operating system, so please take a look at your system’s help documents.