Maths

8 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 for the best free and open source Python maths tools

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

Python Mathematics Tools
NumPyCore package for scientific computing with Python
SciPyEcosystem for mathematics, science, and engineering.
statsmodelsStatistical modeling and econometrics
scikit-learnMachine learning library for Python
SymPyLibrary for symbolic mathematics
SageMathComputer algebra system
mpmathLibrary for arbitrary-precision floating-point arithmetic
patsyPackage for describing statistical models and to build design matrices

This article has been revamped in line with our recent announcement.

Best Free and Open Source SoftwareRead our complete collection of recommended free and open source software. Our curated compilation covers all categories of software.

The software collection forms part of our series of informative articles for Linux enthusiasts. There are hundreds of in-depth reviews, open source alternatives to proprietary software from large corporations like Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

There are also fun things to try, hardware, free programming books and tutorials, and much more.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
William P
William P
5 years ago

Are there more articles planned covering Python tools?