Skip to content
Generate plots and animations of exponential sums
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Exponential Sums

An exponential sum is represented by the following equation

where the exponential is a complex number. The function f(n) is a real-valued function defined for a sequence of positive integers. The Python package expsum plots the exponential sum in the complex plane as a progression of partial sums. The x-axis on the plot is the real part and the y-axis is the imaginary part.

This project is inspired by John Cook's article "Exponential sums make pretty pictures".

Installation and Usage

Requires Python 3, NumPy, and Matplotlib.

Clone this repository and run the following command:

>>> python expsum func1 2000 10 7 17

Create an animated plot by passing the optional --anim argument:

>>> python expsum func1 2000 10 7 17 --anim


Examples of the functions available in the expsum package are shown below.

Function 1

>>> python expsum func1 2000 10 7 17

>>> python expsum func1 8000 11 21 31

Function 2

>>> python expsum func2 1200 100

>>> python expsum func2 4000 800

Function 3

>>> python expsum func3 1000

>>> python expsum func3 4000

Function 4

>>> python expsum func4 4000 4

Function 5

python expsum func5 4000 50 100

Function 6

>>> python expsum func6 2000 4

Function 7

>>> python expsum func7 8000 4


Submit a Pull Request if you would like to contribute to this project. Questions and other comments can be submitted on the Issues page. Another way to contribute is by making a small donation to the Tip Jar.

Tip Jar

Support this project by making a donation at Thank you 😁


  1. John D. Cook. Exponential sums make pretty pictures. October 7, 2017.
  2. David Angell. Exponential sums. School of Mathematics and Statistics, UNSW. Accessed July 7, 2019.
  3. Wikipedia contributors. Exponential sum. In Wikipedia, The Free Encyclopedia. Accessed July 20, 2019.
You can’t perform that action at this time.