Doubly periodic functions

Functions like sine and cosine are periodic. For example, sin(x + 2πn) = sin(x) for all x and any integer n, and so the period of sine is 2π. But what happens if you look at sine or cosine as functions of a complex variable? They’re still periodic if you shift left or right, but not if you shift up or down. If you move up or down, i.e. in a pure imaginary direction, sines and cosines become unbounded.

Doubly periodic functions are periodic in two directions. Formally, a function f(z) of complex variable is doubly periodic if there exist two constants ω1 and ω2 such that

f(z) = f(z + ω1) = f(z + ω2)

for all z. The ratio ω1 / ω2 cannot be real; otherwise the two periods point in the same direction. For the rest of this post, I’ll assume ω1 = 1 and ω2 = i. Such functions are periodic in the horizontal (real-axis) and vertical (imaginary-axis) directions. They repeat everywhere their behavior on the unit square.

What do doubly periodic functions look like? It depends on what restrictions we place on the functions. When we’re working with complex functions, we’re typically interested in functions that are analytic, i.e. differentiable as complex functions.

Only constant functions can be doubly periodic and analytic everywhere. Why? Our functions take on over and over the values they take on over the unit square. If a function is analytic over the (closed) unit square then it’s bounded over that square, and since it’s doubly periodic, it’s bounded everywhere. By Liouville’s theorem, the only bounded analytic functions are constants.

This says that to find interesting doubly periodic functions, we’ll have to relax our requirements. Instead of requiring functions to be analytic everywhere, we will require them to be analytic except at isolated singularities. That is, the functions are allowed to blow up at a finite number of points. There’s a rich set of such functions, known as elliptic functions.

There are two well-known families of elliptic functions. One is the Weierstrass ℘ function (TeX symbol wp, Unicode U+2118) and its derivatives. The other is the Jacobi functions sn, cn, and dn. These functions have names resembling familiar trig functions because the Jacobi functions are in some ways analogous to trig functions.

It turns out that all elliptic functions can be written as combinations either of the Weierstrass function and its derivative or combinations of Jacobi functions. Roughly speaking, Weierstrass functions are easier to work with theoretically and Jacobi functions are easier to work with numerically.

Related posts:

How many trig functions are there?
College math in a single symbol
Diagram of special function relationships

Read More

It takes more than a better mouse trap

Emerson was wrong. The world will not beat a path to your door just because you build a better mouse trap.

No busy, overstressed, fire-putting-out, content-with-the-product-they-have-now person really wants to hear from you. Even when you do build a better mousetrap, the world thinks you’re a giant pain in the ass. Nobody has the time, nobody has the patience, nobody wants to take the risk that your claims are exaggerated … We have to be invited in or we never get to tell our tale.

From Why Johnny Can’t Brand.

Not only does this apply to consumer and business products, it applies to science as well.

Related post:

Getting women to smoke

Read More

High-brow limericks

Philosophy

Said Plato: “These things that we feel
Are not ontologically real,
But just the excresence
Of numinous essence
Our senses can never reveal.”

via Futility Closet

Calculus

The integral z-squared dz
From one to the cube root of 3
Times the cosine
Of three pi over nine
Is the log of the cube root of e.

via Scott Franklin

Biology

Planktonic cells are all alone;
More typically in biofilms grown.
Bacterial masses
Whose abundance surpasses
The weight of all elephants known.

via Brendan Niemira

A prime number

Two quintillion, seventy-seven
Quadrillion, three hundred eleven
Trillion, one billion,
Twenty-four million,
One thousand two hundred and seven.

via Andrew

Topology

The topological part of my brain
Finds Möbius strips quite a strain.
But I make you this pledge:
I’ll glue one at its edge
And build a real projective plane.

By Richard Elwes

Feel free to contribute your own limericks in the comments, but please follow these guidelines:

  1. Keep it geeky.
  2. Keep it clean.

Related posts:

Limerick primes
Sonnet primes

Read More

Fifteen interviews

Seven Nine people I have interviewed:

  1. Rick Richter, CIO of Food for the Hungry
  2. Eric Floehr, owner of ForecastWatch
  3. Frederick Brooks, computer pioneer and author
  4. Robert Ghrist, applied topologist
  5. Cliff Pickover, mathematician and author
  6. Dan Bricklin, software developer and author
  7. Carl Franklin, musician and software developer
  8. Michael Hammer, GIMP developer and author (new)
  9. Sacha Chua, sketch artist, consultant, and Emacs fan

Two Four people who have interviewed me:

  1. Vincent Tan in his online magazine Singularity
  2. Samuel Hansen in his podcast Strongly Connected Components
  3. Erik Meijer and Channel 9 (new)
  4. Romy Misra on Data Science and Analytics (new)

Six interviews I have blogged about:

  1. Henry Petroski, engineer
  2. Arnold Kling, economist
  3. David Spiegelhalter, statistician
  4. Billy Hollis, software developer
  5. Eugenia Chang, mathematician
  6. Charles Bamforth, beer scholar

Read More

Square root interview question

Imagine some of the answers you might get to  “What is the square root of 101?” First, three answers that suggest an interviewee is not strong with math.

  • What’s a square root?
  • You gotta calculator?
  • 101 doesn’t have a square root.

And here are some other answers that might give an idea where an interviewee is coming from.

  • An irrational number. (Pure mathematician)
  • Approximately 10. (Engineer)
  • Somewhere between 10 and 11, closer to 10. (Better engineer)
  • Approximately 10.05, based on a linear Taylor approximation centered at 100 (Applied mathematician)
  • Approximately 10.05, based on one step of Newton’s method (Computer scientist)

(This is just for amusement. I don’t think quiz show-like interviews are a good way to find people you want to work with for years.)

Related posts:

Writes large, correct programs
Dumb and gets things done

Read More

Platform lock-in

From Baron Schwartz speaking at the O’Reilly Media MySQL Conference:

We talk about proprietary vendor lock-in, but in many cases the reality is that anyone who uses any platform, even an open source one, ends up being locked-in to some extent. Switching is something you just can’t contemplate after a while.

Read More

How to fit an elephant

John von Neumann famously said

With four parameters I can fit an elephant, and with five I can make him wiggle his trunk.

By this he meant that one should not be impressed when a complex model fits a data set well. With enough parameters, you can fit any data set.

It turns out you can literally fit an elephant with four parameters if you allow the parameters to be complex numbers.

I mentioned von Neumann’s quote on StatFact last week and Piotr Zolnierczuk replied with reference to a paper explaining how to fit an elephant:

“Drawing an elephant with four complex parameters” by Jurgen Mayer, Khaled Khairy, and Jonathon Howard,  Am. J. Phys. 78, 648 (2010), DOI:10.1119/1.3254017.

Piotr also sent me the following Python code he’d written to implement the method in the paper. This code produced the image above.

"""
Author: Piotr A. Zolnierczuk (zolnierczukp at ornl dot gov)

Based on a paper by:
Drawing an elephant with four complex parameters
Jurgen Mayer, Khaled Khairy, and Jonathon Howard,
Am. J. Phys. 78, 648 (2010), DOI:10.1119/1.3254017
"""
import numpy as np
import pylab

# elephant parameters
p1, p2, p3, p4 = (50 - 30j, 18 +  8j, 12 - 10j, -14 - 60j )
p5 = 40 + 20j # eyepiece

def fourier(t, C):
    f = np.zeros(t.shape)
    A, B = C.real, C.imag
    for k in range(len(C)):
        f = f + A[k]*np.cos(k*t) + B[k]*np.sin(k*t)
    return f

def elephant(t, p1, p2, p3, p4, p5):
    npar = 6
    Cx = np.zeros((npar,), dtype='complex')
    Cy = np.zeros((npar,), dtype='complex')

    Cx[1] = p1.real*1j
    Cx[2] = p2.real*1j
    Cx[3] = p3.real
    Cx[5] = p4.real

    Cy[1] = p4.imag + p1.imag*1j
    Cy[2] = p2.imag*1j
    Cy[3] = p3.imag*1j

    x = np.append(fourier(t,Cx), [-p5.imag])
    y = np.append(fourier(t,Cy), [p5.imag])

    return x,y

x, y = elephant(np.linspace(0,2*np.pi,1000), p1, p2, p3, p4, p5)
pylab.plot(y,-x,'.')
pylab.show()

Related posts:

Advantages of crude models
Occam’s razor and Bayes theorem

Read More

An unexpected Father's Day card

As an undergraduate I was part of an honors program called Dean’s Scholars. I have a T-shirt from a Dean’s Scholars reunion several years ago that my wife doesn’t appreciate as much as I do. She thinks I shouldn’t wear it just because it has started to deteriorate.

She surprised me today with a new Dean’s Scholars T-shirt as a Father’s Day present. She told me that when she asked to buy a T-shirt, the honors program insisted on giving it too her. They also included a handwritten card wishing me a happy Father’s Day.

I was especially impressed with the card. That wasn’t scripted; I don’t imagine they get that many calls like my wife’s. It was just someone being thoughtful. That made a bigger impression on me than all glossy publications I’ve gotten since I graduated.

Read More

A surprise with Emacs and Office 2007

I had a little surprise when I tried to open an Excel file from Emacs. I was using dired, a sort of file explorer inside Emacs. I expected one of two things to happen. Maybe Emacs would know to launch the file using Excel. Or maybe it would open the binary file as a bunch of gibberish. Instead I got something like this:

screenshot

This was disorienting at first. Then I thought about how Office 2007 documents are zipped XML files. But how does dired know that my .xlsx file is a zip file? I suppose since Emacs is a Unix application at heart, it’s acting like a Unix application even though I was using it on Windows. It’s determining the file type by inspected the file itself and ignoring the file extension.

(Office 2007 documents are not entirely XML. The data and styling directives are XML, but embedded files are just files. The spreadsheet in this example contains a large photo. That photo is a JPEG file that gets zipped up with all the XML files that make up the spreadsheet.)

So I learned that Emacs knows how to navigate inside zip files, and that a convenient way to poke around inside an Office 2007 file is to browse into it from Emacs.

Here’s another post that discusses Emacs and Office 2007, contrasting their interface designs: Clutter-discoverability trade-off

Read More

Impure math

When Samuel Hansen said in his interview “You’re not a pure mathematician” I agreed without thinking, but later the statement bothered me a little. I know what he meant: considering the two categories of pure math and applied math, you’d put yourself in the latter category. Which is true.

But the term “pure” math can be misleading, as if everyone else does impure math. Applied math is not an alternative to theoretical math. Applied mathematicians prove theorems etc. We work on applications in addition to doing what is expected of pure mathematicians. The difference between pure and applied math is motivation, not content. Applied math is motivated by direct application to non-mathematical problems. Pure math seeks to advance math for its own sake. Both are important.

Statistics uses the terms “theoretical” and “applied” rather than “pure” and “applied.” Math doesn’t use “theoretical” as an antithesis to “applied” because applied math is theoretical. But unlike math, being “applied” in statistics does mean you’re often (too often?) excused from proving theorems. The first time I was a coauthor on a statistics paper I was surprised to find out you could publish with just simulation results and no theorems. This happens in applied math as well, but not nearly as often as it does in applied statistics.

On the other hand, when I hear the term “applied statistics” I want to ask “Is there any other kind?” Statistics is applied (and theoretical!) though some statisticians work more directly on applications than others. As Andrew Gelman quips, the difference between theoretical and applied statisticians is that

The theoretical statistician uses x, the applied statistician uses y (because we reserve x for predictors).

I assume that statement wasn’t meant to be taken literally, but I agree with the sentiment that the distinction between theoretical and applied statistics can be exaggerated. I’d say the same applies to pure and applied math.

Read More