# and e

Mathematics and other neat things

This video shows continuous variation in angle (from 0 to Pi) of the connect-the-dots algorithm while keeping all other parameters fixed. Each instant is a valid 2-coloring.

Music: “Derbyshire” by Nerve

Mathematica code:

Manipulate[  ImageCrop[   Graphics[    GraphicsComplex[     Table[      {-(.96)^n*Sin[n*.001 f], .96^n*Cos[n*.001 f]},      {n, 0, 300}],    Polygon[Table[i, {i, 1, 300, 1}]]],   PlotRange -> .1, ImageSize -> 640], {640, 480}],{f, 1, 3145, 1}]

Let $$S_n (z) = \sum_{k=0}^n z^k$$ then parametrize $$S_n$$ on circles in the complex plane centered at the origin. The animation shows the graph of the real part of $$S_{100} (r e^{2\pi i t})$$ as a function of $$t$$ and how it changes as $$r$$ ranges from $$0$$ to $$1$$.

### Source Code

Source code for the previous post. Not quite complete since I ended up using Unix commands to put the individual pictures together.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mplcolors

width = 256
height = 256
length = 40
maxiter = 40

fig = plt.figure(figsize=(float(width)/100, float(height)/100), edgecolor=’k’)
fig.subplots_adjust(left=0.0, right=1.0, top=1.0, bottom=0.0, wspace=0.0, hspace=0.0)
ax = fig.add_subplot(111)

x1 = -1.0
x2 = 1.0

y1 = (x1 - x2)/2 * float(height)/width
y2 = (x2 - x1)/2 * float(height)/width

y, x = np.ogrid[y1:y2:height*1j, x1:x2:width*1j]

cdict = {‘red’: ((0.0, 0.4, 0.4),
(0.5, 0.7, 0.7),
(1.0, 1.0, 1.0)),
‘green’: ((0.0, 0.0, 0.0),
(0.5, 1.0, 1.0),
(1.0, 1.0, 1.0)),
‘blue’: ((0.0, 1.0, 1.0),
(0.5, 1.0, 1.0),
(1.0, 1.0, 1.0))}
my_cmap = mplcolors.LinearSegmentedColormap(‘my_colormap’, cdict, 256)

for n in xrange(length):
t = float(n+1)/length
e = np.exp(2*np.pi*t*1j)
c = e/2*(1-e/2)

z = x + y*1j
divtime = maxiter + np.zeros(z.shape, dtype=int)

for k in xrange(maxiter):
z = z*z + c
diverge = z*np.conj(z) > 4
div_now = diverge & (divtime == maxiter)
divtime[div_now] = k
z[diverge] = 2

ax.cla()
ax.imshow(divtime, cmap=my_cmap)
ax.axis(‘off’)
filename = ‘JuliaSet_{:03}.png’.format(n+1)
fig.savefig(filename)

Julia set for $$f_c(z) = z^2 + c$$ with $$c = \frac{e^{2 \pi i t}}{2} (1 - \frac{e^{2 \pi i t}}{2} )$$ where $$t \in [0,1]$$. These values of $$c$$ correspond to the boundary of the main cardioid of the Mandelbrot set.

Various values of $$1^\pi$$ in the complex plane. It is worth noting that the seventh value is very close to $$1$$. This corresponds to $$\frac{22}{7}$$ being a very good rational approximation to $$\pi$$. Also very interesting: the next closest to $$1$$ is the $$106^{th}$$ value. This corresponds to the second convergent, $$\frac{333}{106}$$, in the continued fraction expression for $$\pi$$.

### Basel Problem

First we want to an expression for
$f(z) = \sum_{n=1}^\infty \frac{1}{n}z^n.$
We do this by noting that
$f’(z) = \sum_{n=0}^\infty z^n = \frac{1}{1-z}.$
So
$f(z) = \int \frac{1}{1-z} \mathrm{d}z = -\log (1-z) + C.$
Evaluating both sides at $$z=0$$ shows that $$C=0$$. Now let $$z=e^{ix}$$ and equate imaginary parts
$\sum_{n=1}^\infty \frac{\sin (n x)}{n} = -\mathfrak{Im} (\log(1-e^{ix})).$
However, for any $$w\in\mathbb{C}$$, $$\log(w) = \log(|w|e^{i\mathrm{Arg}(w)}) = \log(|w|) + i\mathrm{Arg}(w)$$ and $$\mathrm{Arg}(w) = \arctan (\frac{\mathfrak{Im}(w)}{\mathfrak{Re}(w)})$$. Now, we have $$1-e^{ix} = 1-\cos(x) + i\sin(x)$$ so $$\mathrm{Arg}(1-e^{ix}) = \arctan (\frac{\sin(x)}{1-\cos(x)}) = \arctan(\frac{2\sin(\frac{1}{2}x)\cos(\frac{1}{2}x)}{2\sin^2(\frac{1}{2}x)}) = \arctan(\cot(\frac{1}{2}x))$$, which is equal to $$\frac{\pi}{2} - \frac{1}{2}x$$. So finally we get
$\sum_{n=1}^\infty \frac{\sin(nx)}{n} = \frac{1}{2}x - \frac{\pi}{2}.$
We can now find the anti-derivative of both sides to get
$-\sum_{n=1}^\infty \frac{\cos(nx)}{n^2} = \frac{1}{4}x^2 - \frac{\pi}{2}x + C.$
But we can find $$C$$ by noting that
$-\int_0^{2\pi} \sum_{n=1}^\infty \frac{\cos(n x)}{n^2} \mathrm{d}x = 0.$
We have
$\int_0^{2\pi} \frac{1}{4}x^2 - \frac{\pi}{2}x + C \;\mathrm{d}x = [\frac{1}{12}x^3 - \frac{\pi}{4}x^2 + Cx]^{2\pi}_0 = \frac{\pi^3}{3} + 2\pi C = 0.$
So $$C = -\frac{\pi^2}{6}$$ and we have established the equality
$-\sum_{n=1}^\infty \frac{\cos(nx)}{n^2} = \frac{1}{4}x^2 - \frac{\pi}{2}x - \frac{\pi^2}{6}.$
If we let $$x=0$$ we see that
$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}.$

A curve in $$\mathbb{C}$$ given by $$\zeta(\frac{1}{2}+it)$$. Here $$\zeta(s)$$ refers to the analytic continuation of
$\zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}.$

### Mathjax

I just put mathjax into my theme, so I am testing it out. If p is an odd prime, then

Read More

Making use of music theory, group theory, and category theory

From Musical Actions of Dihedral Groups

Abstract:
The sequence of pitches which form a musical melody can be transposed or inverted. Since the 1970s, music theorists have modeled musical transposition and inversion in terms of an action of the dihedral group of order 24. More recently music theorists have found an intriguing second way that the dihedral group of order 24 acts on the set of major and minor chords. We illustrate both geometrically and algebraically how these two actions are {\it dual}. Both actions and their duality have been used to analyze works of music as diverse as Hindemith and the Beatles.

Summary:
This paper connects the twelve musical tones to elements in the dihedral group of order 24 (the symmetries of a regular dodecagon). The translation from pitch classes to integers modulo 12 allows for the modeling of musical works using abstract algebra. The first action on major and minor chords described in the paper is based on the musical techniques of transposition and inversion. A transposition moves a sequence of pitches up or down and an inversion reflects a melody about a fixed axis. The other action arises from the P, L, and R operations of the 19th-century music theorist Hugo Riemann. It is through these operations that the dihedral group of order 24 acts on the set of major and minor triads. The paper also describes how the P, L, and R operations have beautiful geometric presentations in terms of graphs. In particular the authors describe a connection between the PLR-group and chord progressions in Beethoven’s 9th Symphony, which leads to a proof that the PLR-group is dihedral. Another musical example is Pachelbel’s Canon in D. In summary, the paper gives a very pretty explanation of what we commonly hear in tonal music in terms of elementary group theory.