Spirals in Jupyter

In jupyter, you must explicitly designate a cell as markdown - by default, cells are code.

First, we'll import numpy for mathematical calculations and matplotlib's pyplot for plotting.

Logarithmic Spiral

The logarithmic spiral has a polar equation of $$r = a e^{b\theta}$$ where $r$ is distance from the origin, $\theta$ is the angle from the x-axis, and $a$ and $b$ are constants. Source

We can write the logarithmic spiral equation in Cartesian coordinates as: $$\begin{array} x &= r \cos\theta = a \cos\theta e^{b\theta}\\y &= r \sin\theta = a \sin\theta e^{b\theta}\end{array}$$

We can implement this spiral in R by first defining it in polar coordinates and then converting the polar coordinates into a sequence of Cartesian points that should be connected by line segments.

I'm less familiar with plotting in python than I am in R, but this code seems to work to generate the same type of plot:

The same type of markdown formatting works in jupyter notebooks as well:

With markdown, I can create nice formatting with simple text -

First header

Second header

A really nice quote

Third header

some code from an unknown language

I also like the ability to make

  1. numbered
  2. lists

but sometimes you want to make a

I have to put a blank line between the text and the list for the formatting to work just right. When in doubt, add a blank line :).