# Drawing an elephant with four complex parameters

> An annotated edition of this paper on Fermat's Library, where scientists and readers explain its ideas, equations and history in the margins. Annotated edition: https://fermatslibrary.com/s/drawing-an-elephant-with-four-complex-parameters

- **Authors:** J. Mayer, K. Khairy, J. Howard
- **Topic:** Physics
- **Original:** https://s3-us-west-1.amazonaws.com/fermatslibrary/uploads%2F1519042543060-y3mt8zorknd-babc1df49d7555ac9bc687dc8e76bb2e%2Fpdfresizer.com-pdf-crop+%281%29.pdf
- **Pages:** 2
- **Annotations:** 9 comments in 6 threads
- **Featured:** Fermat's Library Journal Club
- **Annotated edition:** https://fermatslibrary.com/s/drawing-an-elephant-with-four-complex-parameters

## Annotations

### Annotation 1 (page 1)

Beside the passage: “Jürgen Mayer Max Planck Institute of Molecular Cell Biology and Genetics, Pfotenhauerstr. 108, 01307 Dresden, Germany”

**Annotation** by G.R. Morgensonne (2021-03-28):

> I looked at the python code and it seems to draw the outline of an elephant. However the animation does not come from that code. How does p[5].re  get incorporated into the Ax, Ay, Bx, By arrays to wiggle the trunk?

### Annotation 2 (page 1)

Beside the passage: “A turning point in Freeman Dyson’s life occurred during a meeting in the Spring of 1953 when Enrico Fermi criticized the complexity of Dyson’s model by quoting Johnny von Neumann: 1 “With four parameters I can ﬁt an elephant, and with ﬁve I can make him wiggle his trunk.” Since then it has become a well-known saying …”

**Annotation** by Luís Batalha (2018-02-19):

> [Freeman Dyson](https://en.wikipedia.org/wiki/Freeman_Dyson) was working at the time with a team of graduate students and postdocs from Cornell to calculate the effects of the strong force in the scattering of mesons by protons. He was inspired by the calculations that had been previously done for Quantum Electrodynamics which showed a tremendous agreement between experiment and theory. He wanted to do the same for the strong force and compare it with [Fermi's](https://en.wikipedia.org/wiki/Enrico_Fermi) measurements of the scattering of mesons by protons.
>
> To calculate the meson-proton scattering, he used a theory of the strong forces known as pseudoscalar meson theory. The problem was that electromagnetic forces are weak and in the pseudoscalar theory the forces are so strong that in order to calculate anything you'd need to introduce artificial parameters (cut-offs) in the integrals to avoid divergences.
>
> When Dyson showed Fermi the scattering calculations, Fermi pointed that the arbitrary cut-offs are "are not based either on solid physics or on solid mathematics", challenging the validity of the calculations. Finally after knowing that Dyson used 4 parameters (cut-offs) for the calculations he quoted his friend John Von Neumann saying that "with 4 parameters I can fit an elephant, and with 5 I can make him wiggle his trunk"
>
> Fermi was in the end absolutely right. A few years after Fermi died, Murray Gell-Mann discovered quarks, the missing link to make sense of strong interactions (mesons and protons are simply little bags made of quarks).
>
> Dyson describes the episode in more detail in this charming interview with Web of Stories.
>
>
> [!['aw'](https://i.ytimg.com/vi/kEAy6ClrDLA/hqdefault.jpg)](https://www.youtube.com/watch?v=hV41QEKiMlM)

**Reply** by Antonio Viggiano (2018-02-20):

> Great paper, didn't know about this lovely story

### Annotation 3 (page 1)

Beside the passage: “where A k x , B k x , A k y , and B k y are the expansion coefﬁcients. The lower indices k apply to the kth term in the expansion, and the upper indices denote the x or y expansion, respectively.”

**Annotation** by Luís Batalha (2018-02-19):

> ***How to use Epicycles to draw any image***
>
> To understand how we can use the Fourier series to draw any arbitrary shape let's start with a simple example: the circle.
>
> ![](https://i.imgur.com/1UmWjkj.gif)
>
> A way to express the coordinates (x,y) of the green dot as a function of time is:
> $$
> x(t) = R \cos(w t)\\
> y(t) = R \sin(w t)\\
> $$
>
> By adding additional circles and varying their speeds and sizes, it is possible to draw increasingly complex curves called epicycles.
>
> More generally epicycles are curves governed by the equations:
>
> $$
> x(t) =  \sum_i R_i \cos(w_i t + \phi_i)\\
> y(t) =  \sum_i R_i \sin(w_i t + \phi_i)\\
> $$
>
> where $\phi_i$ is just a phase corresponding to how much the disk is rotated at $t=0$.
>
> With epicycles you can draw very complex images such as this one:
>
> ![](https://media.giphy.com/media/5sYuAhjih2LvHRq7nl/giphy.gif)
>
> The way to make an epicycle draw a specific image is by sampling a few points from the image and then force the functions $x(t)$ and $y(t)$ to pass as close as possible to the sampled points - for instance, minimizing the mean square error by varying the $R_i, w_i$ and $\phi_i$.
>
> To do this, it's convenient to work in the complex plane so that:
>
> $$
> p_j = x_j + iy_j \\
> p(t) = x(t) + iy(t)= \sum_j^{N} R_j( \cos(w_i t + \phi_i) + i\sin(w_i t + \phi_i))=\sum_j^{N} R_j e^{iw_jt+\phi_j}
> $$
>
> where N is just the total number of circles. A final assumption that we can do to further simplify things: instead of choosing N arbitrary speeds w, we'll make the speeds be 0 (stationary), 1x, -1x, 2x, -2x, 3x, -3x, ... N/2x, -N/2x.
>
> $$
> p(t) = \sum_{j=0}^{N} \underbrace{X_j}_{R_je^{\phi_j}} e^{\frac{2\pi i j}{N}t}
> $$
>
> This expression is just a Discrete Fourier Transform, which means we can use it on the points $p_j$ and get the coefficients $X_j$!

### Annotation 4 (page 1)

Beside the passage: “Using this expansion of the x and y coordinates, we can analyze shapes by tracing the boundary and calculating the coefﬁcients in the expansions !using standard methods from Fourier analysis". By truncating the expansion, the shape is smoothed. Truncation leads to a huge reduction in the information necessary to …”

**Annotation** by Jim Shilliday (2018-02-20):

> Apparently a spelling error -- obviously should be "trunkation."  Also, for drawing with epicycles, check Engare on Steam.

**Reply** by James G Beldock (2018-02-21):

> At least in American English, *truncate* (with a letter *'c'*) is the correct spelling. [ref](http://www.dictionary.com/browse/truncate)

**Reply** by Antonio Viggiano (2018-02-21):

> I think he's joking because the article talks about the elephant's *trunk*

### Annotation 5 (page 2)

Beside the passage: “p 1 =50−30iB 1 x =50 B 1 y =−30 p 2 =18+8iB 2 x =18 B 2 y =8 p 3 =12−10iA 3 x =12 B 3 y =−10 p 4 =−14−60iA 5 x =−14 A 1 y =−60 p 5 =40+20i Wiggle coeff.=40 x eye =y eye =20”

**Annotation** by Luís Batalha (2018-02-19):

> Taking these parameters and writing a Python script to implement them we end up with:
>
> ```python
> """
> 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()
> ```
>
> Finally we get the elephant wiggling his trunk
>
> ![](https://i.imgur.com/XnYFboV.gif)

### Annotation 6 (page 2)

Beside the passage: “1 F. Dyson, “A meeting with Enrico Fermi,” Nature !London" 427!6972", 297 !2004". 2 F. P. Kuhl and C. R. Giardina, “Elliptic Fourier features of a closed contour,” Comput. Graph. Image Process. 18, 236–258 !1982". 3 G. Székely, A. Kelemen, C. Brechbühler, and G. Gerig, “Segmentation of 2D and 3D objects from MRI …”

**Annotation** by mitch rybczynski (2018-02-20):

> References 5 and 6 are both dead links to java applets, no obvious backups exist...  The fate of all URL references?

## Full text

Extracted from the PDF. [Annotation N] marks where each annotation above sits.

#### Page 1

Drawing an elephant with four complex parameters

Jürgen Mayer Max Planck Institute of Molecular Cell Biology and Genetics, Pfotenhauerstr. 108, 01307 Dresden, [Annotation 1] Germany

Khaled Khairy European Molecular Biology Laboratory, Meyerhofstraße. 1, 69117 Heidelberg, Germany

Jonathon Howard Max Planck Institute of Molecular Cell Biology and Genetics, Pfotenhauerstr. 108, 01307 Dresden, Germany

!Received 20 August 2008; accepted 5 October 2009"

We deﬁne four complex numbers representing the parameters needed to specify an elephantine shape. The real and imaginary parts of these complex numbers are the coefﬁcients of a Fourier coordinate expansion, a powerful tool for reducing the data required to deﬁne shapes. © 2010 American Association of Physics Teachers. #DOI: 10.1119/1.3254017$

A turning point in Freeman Dyson’s life occurred during a meeting in the Spring of 1953 when Enrico Fermi criticized the complexity of Dyson’s model by quoting Johnny von Neumann: 1 “With four parameters I can ﬁt an elephant, and with ﬁve I can make him wiggle his trunk.” Since then it has [Annotation 2] become a well-known saying among physicists, but nobody has successfully implemented it.

To parametrize an elephant, we note that its perimeter can be described as a set of points !x!t",y!t"", where t is a parameter that can be interpreted as the elapsed time while going along the path of the contour. If the speed is uniform, t becomes the arc length. We expand x and y separately 2 as a Fourier series

x!t" = % k=0

!

!A k x cos!kt" + B k x sin!kt"", !1"

y!t" = % k=0

!

!A k y cos!kt" + B k y sin!kt"", !2"

where A k x , B k x , A k y , and B k y are the expansion coefﬁcients. The lower indices k apply to the kth term in the expansion, and [Annotation 3] the upper indices denote the x or y expansion, respectively.

Using this expansion of the x and y coordinates, we can analyze shapes by tracing the boundary and calculating the coefﬁcients in the expansions !using standard methods from Fourier analysis". By truncating the expansion, the shape is smoothed. Truncation leads to a huge reduction in the information necessary to express a certain shape compared to a pixelated image, for example. Székely et al. 3 used this approach to segment magnetic resonance imaging data. A simi- [Annotation 4] lar approach was used to analyze the shapes of red blood cells, 4 with a spherical harmonics expansion serving as a 3D generalization of the Fourier coordinate expansion.

The coefﬁcients represent the best ﬁt to the given shape in the following sense. The k =0 component corresponds to the center of mass of the perimeter. The k=1 component corresponds to the best ﬁt ellipse. The higher order components

trace out elliptical corrections analogous to Ptolemy’s epicycles. 5 Visualization of the corresponding ellipses can be found at Ref. 6.

We now use this tool to ﬁt an elephant with four parameters. Wei 7 tried this task in 1975 using a least-squares Fourier sine series but required about 30 terms. By analyzing the picture in Fig. 1!a" and eliminating components with amplitudes less than 10% of the maximum amplitude, we obtained an approximate spectrum. The remaining amplitudes were

 



     













Fig. 1. !a" Outline of an elephant. !b" Three snapshots of the wiggling trunk.

648 648Am. J. Phys. 78 !6", June 2010 http://aapt.org/ajp © 2010 American Association of Physics Teachers

Downloaded 25 Sep 2013 to 131.211.208.19. Redistribution subject to AAPT license or copyright; see http://ajp.aapt.org/authors/copyright_permission

#### Page 2

slightly modiﬁed to improve the aesthetics of the ﬁnal image. By incorporating these coefﬁcients into complex numbers, we have the equivalent of an elephant contour coded in a set of four complex parameters !see Fig. 1!b"".

The real part of the ﬁfth parameter is the “wiggle parameter,” which determines the x-value where the trunk is attached to the body !see the video in Ref. 8". Its imaginary part is used to make the shape more animal-like by ﬁxing the coordinates for the elephant’s eye. All the parameters are speciﬁed in Table I.

The resulting shape is schematic and cartoonlike but is still recognizable as an elephant. Although the use of the Fourier coordinate expansion is not new, 2,3 our approach clearly demonstrates its usefulness in reducing the number of parameters needed to describe a two-dimensional contour. In

the special case of ﬁtting an elephant, it is even possible to lower it to four complex parameters and therein implement a well-known saying.

ACKNOWLEDGMENTS

Many thanks to Jean-Yves Tinevez and Marija Žanić, as well as the anonymous reviewers, for revising and improving this article.

1 F. Dyson, “A meeting with Enrico Fermi,” Nature !London" 427!6972", 297 !2004". 2 F. P. Kuhl and C. R. Giardina, “Elliptic Fourier features of a closed contour,” Comput. Graph. Image Process. 18, 236–258 !1982". 3 G. Székely, A. Kelemen, C. Brechbühler, and G. Gerig, “Segmentation of 2D and 3D objects from MRI volume data using constrained elastic deformations of ﬂexible Fourier contour and surface models,” Med. Image Anal. 1!1", 19–34 !1996". 4 K. Khairy and J. Howard, “Spherical harmonics-based parametric deconvolution of 3D surface images using bending energy minimization,” Med. Image Anal. 12!2", 217–227 !2008". 5 The interactive Java applet written by Rosemary Kennett, &physics.syr.edu/courses/java/demos/kennett/Epicycle/Epicycle.html'. 6 Interactive Java applet of elliptic descriptors by F. Puente León, &www.vms.ei.tum.de/lehre/vms/fourier/'. 7 J. Wei, “Least square ﬁtting of an elephant,” CHEMTECH 5, 128–129 !1975". [Annotation 6] 8 See supplementary material at http://dx.doi.org/10.1119/1.3254017 for the movie showing the wiggling trunk.

Table I. The ﬁve complex parameters p 1 ,...,p 5 that encode the elephant including its wiggling trunk.

Parameter Real part Imaginary part

p 1 =50−30iB 1 x =50 B 1 y =−30 p 2 =18+8iB 2 x =18 B 2 y =8 p 3 =12−10iA 3 x =12 B 3 y =−10 p [Annotation 5] 4 =−14−60iA 5 x =−14 A 1 y =−60 p 5 =40+20i Wiggle coeff.=40 x eye =y eye =20

649 649Am. J. Phys., Vol. 78, No. 6, June 2010 Notes and Discussions

Downloaded 25 Sep 2013 to 131.211.208.19. Redistribution subject to AAPT license or copyright; see http://ajp.aapt.org/authors/copyright_permission

---

Source: [Fermat's Library](https://fermatslibrary.com/) — https://fermatslibrary.com/s/drawing-an-elephant-with-four-complex-parameters. More annotated papers: https://fermatslibrary.com/llms.txt
