# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1733: Astronomer royal

From New Scientist #2901, 26th January 2013 [link]

I was talking to my granddaughter about the solar system and how planets and comets move in ellipses with the sun at one focus. I told her how you could draw an ellipse by sticking two pins in a sheet of paper both equidistant from and in line with the central point, placing a loop of string around them, and then by putting a pencil in the loop and keeping it tight, go right round. The pencil would thus draw the ellipse, each pin being at a focus.

I then asked her to draw the biggest ellipse she could on a sheet of paper 50 centimetres long and 30 cm wide, and then to find the area of the rectangle she could inscribe in her ellipse whose longest side was equal in length to that of the shorter side of the original sheet.

How far apart must she place the pins? How long was the string? What was the area of the inscribed rectangle?

[enigma1733]

### 4 responses to “Enigma 1733: Astronomer royal”

1. Jim Randell 23 January 2013 at 6:05 pm

A bit of geometry yields the answers.

This Python program does the required calculations. (If you want exact answers you can use sqrt() from SymPy instead).

```from enigma import sqrt, printf

# major and minor axes
(a, b) = (25, 15)

# (1) distance between the pins = 2f
f = sqrt(a * a - b * b)
printf("(1) {d} cm", d=2 * f)

# (2) length of the string = 2(a + f)
printf("(2) {s} cm", s=2 * (a + f))

# (3) area of the inscribed rectangle = 4xy
# where (x/a)^2 + (y/b)^2 = 1
x = 15
y = b * sqrt(a * a - x * x) / a
printf("(3) {r} cm^2", r=4 * x * y)
```

Solution: The pins are 40 cm apart. The string is 90 cm long. The inscribed rectangle has an area of 720 sq cm.

• arthurvause 23 January 2013 at 8:15 pm

Should the length of the string be 2a ?

• Jim Randell 23 January 2013 at 8:20 pm

When the loop is horizontal it is stretching from one focus (say, –f) to the opposite “pointy end” (say, a). Hence it has length a + f, and it’s doubled (as it’s a loop), hence 2(a + f).

Or to look at it another way, the loop is composed of two sections, the first is from one focus to the ellipse and then back to the other focus – this has length 2a. And the second section is a straight line from the second focus back to the first – this has length 2f. Hence the total length of the loop is 2a + 2f.

This site uses Akismet to reduce spam. Learn how your comment data is processed.