A mystery curve links to Jupyter

Reviewing some of my less visited links recently, I was intrigued by a post at The Math Less Travelled:

The previous post at the site provides more details of the source of the curve, and some links to an interactive curve generator written in Python, using the Jupyter Notebook. I hadn’t heard of the Jupyter Project, and I will certainly be taking a closer look in the future, but for now I thought I would have a go at creating the curve generator in Excel, which turned out to be surprisingly easy, with no coding required.

The curve is defined by the equation:
f(t) = e^{it} + \frac{1}{2} e^{6it} + \frac{i}{3} e^{-14it}
which looks fairly mysterious to a non-mathematician, but as explained at this Wikipedia article the function consists of three circles in the complex plane, which can be translated into the XY plane with two functions:
x(t) = cos(t) + cos(6t)/2 + cos(-14t)/3
y(t) = sin(t) + sin(6t)/2 + sin(-14t)/3

I have generated these values in Excel in three stages so each component of the curve can be plotted separately, and we can also add a fourth level, as shown in the screenshot below:


The t values in Colum A simply increment by the value in Cell B1 (set to pi/280 in this example).  The x and y values for Curve 1 are Cos(t) and Sin(t), and the values for Curve 2 (as shown in the formula bar for the x value) are:

The links t0 Sheet2 allow the factors for the curve to be easily changed.  The formulas for Curve 2 can then be copied across for Curve 3, and an additional Curve 4 is added.  The formulas in Row 3 are then copied down as far as required.  Finally the actual values to be plotted are extracted in Colums K and L with:
which are also copied down to cover the full range.

Finally values are entered in the appropriate cells on Sheet 2, and the values in Columns K and L are plotted as an XY (Scatter) chart on Sheet 2, resulting in:


We can now experiment with different curves simply by entering different values under a to f, and choosing which curve to plot. Entering the same factors as c and d under e and f, and selecting curve 4 generates:

Changing the sign for factor f:


And increasing the value of e:


The spreadsheet can be downloaded from MysteryCurve.xlsx.
No open source code this time, because there is no code.
Feel free to add slider bars and animation!


If you wondered why my plot looks a bit different to the one in the link, it’s because I didn’t get the function right; the third term is multiplied by i/3, not 1/3.  That makes it a bit more complicated, but it can still be done in code-free in Excel.  I have updated the spreadsheet using the functions Complex(), IMProduct(), IMExp(), IMReal(), and Imaginary().  See the download spreadsheet for details, or just enjoy the corrected image below:


This entry was posted in Charts, Charts, Excel, Maths, Newton and tagged , , , , , , . Bookmark the permalink.

2 Responses to A mystery curve links to Jupyter

  1. jeffrey Weir says:

    Off the planet! Neat-o.


    • dougaj4 says:

      Glad you enjoyed it Jeff.

      BTW, I recently (re)discovered Jordan Goldmeier’s blog, following a link at one of your DDoE pieces, and I have just downloaded his latest book, which is going for a bargain price at the US Amazon site at the moment. Looks like a great read.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s