Maths

12 Essential Free and Open Source Python Maths Tools

Python is a very popular general purpose programming language — with good reason. It’s object oriented, semantically structured, extremely versatile, and well supported. Scientists favour Python because it’s easy to use and learn, offers a good set of built-in features, and is highly extensible. Python’s readability makes it an excellent first programming language.

The Python Standard Library (PSL) is the the standard library that’s distributed with Python. The library comes with, among other things, modules that carry out many mathematical operations.

The math module is one of the core modules in PSL which performs mathematical operations. The module gives access to the underlying C library functions for floating point math.

It offers number-theoretic and representation functions, power and logarithmic functions, trigonometric functions, angular conversion, hyperbolic functions, special functions, and constants. Here’s a quick example:

Python math module

PSL also provides other mathematics functions:

  • cmath – provides access to mathematical functions for complex numbers.
  • decimal – provides support for fast correctly-rounded decimal floating point arithmetic.
  • fractions – provides support for rational number arithmetic.
  • random – implements pseudo-random number generators for various distributions.
  • statistics – provides functions for calculating mathematical statistics of numeric data. The statistics module is a relatively late addition; it was added in Python 3.4.
  • numbers – numeric abstract base classes.

Here’s the statistics module performing some simple statistical averaging (mean, mode, and median respectively).

python statistics module

But PSL is literally the tip of the iceberg. Python has thousands of components available ranging from individual programs and modules to packages and entire application development frameworks. We’ve covered some of these components in other Python articles. Some of the software will be of interest to mathematicians particularly our article on Python Visualization Packages. Software like matplotlib, seaborn, pandas, and Bokeh are some of our go-to libraries.

We want to share some great libraries and tools that are useful for mathematicians working with Python. They expand immensely on the mathematics functionality provided by the Python Standard Library. They are all released under an open source license.

Here’s our verdict captured in a legendary LinuxLinks-style ratings chart.

Ratings chart

Click the links in the table below to learn more about each tool.

Python Mathematics Tools
scikit-learnMachine learning library for Python
NumPyCore package for scientific computing with Python
SciPyEcosystem for mathematics, science, and engineering.
statsmodelsStatistical modeling and econometrics
JAXPython library for high-performance numerical computing
SageMathComputer algebra system
SymPyLibrary for symbolic mathematics
PyMCBayesian statistical modeling and probabilistic programming
PyomoObject-oriented algebraic modeling language
patsyPackage for describing statistical models and to build design matrices
mpmathLibrary for arbitrary-precision floating-point arithmetic
SfePyFinite element software package

This article has been updated to reflect the changes outlined in our recent announcement.

Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
2 Comments
Oldest
Newest Most Voted
William P
William P
8 years ago

Are there more articles planned covering Python tools?