Posted on Aug 4th, 2019
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 exponential sum can be plotted 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.
The Python package
expsum is a command line tool to plot and optionally animate the exponential sum for a specific function. See the exponential-sums repository on GitHub for installation and usage instructions. Examples of using the
expsum tool for various functions are shown below. An animated plot can be displayed using the optional
--anim argument. See the GitHub repo for more details.
>>> python expsum func1 2000 10 7 17
>>> python expsum func1 8000 11 21 31
>>> python expsum func2 1200 100
>>> python expsum func2 4000 800
>>> python expsum func3 1000
>>> python expsum func3 4000
>>> python expsum func4 4000 4
>>> python expsum func5 4000 50 100
>>> python expsum func6 2000 4
>>> python expsum func7 8000 4
This article was inspired by John Cook’s blog post “Exponential sums make pretty pictures”.