Constellations in Mathematica

Mathematica has data on stars and constellations. Here is Mathematica code to create a list of constellations, sorted by the declination (essentially latitude on the celestial sphere) of the brightest star in the constellation.

constellations = EntityList["Constellation"]
sorted = SortBy[constellations, -#["BrightStars"][[1]]["Declination"] &]

We can print the name of each constellation with

Map[#["Name"] &, sorted]

This yields

{"Ursa Minor", "Cepheus", "Cassiopeia", "Camelopardalis", 
…, "Hydrus", "Octans", "Apus"}

We can print the name of the constellation along with its brightest star as follows.

Scan[Print[#["Name"], ", " #["BrightStars"][[1]]["Name"]] &, sorted]

This prints

Ursa Minor, Polaris
Cepheus, Alderamin
Cassiopeia, Tsih
Camelopardalis, β Camelopardalis
Hydrus, β Hydri
Octans, ν Octantis
Apus, α Apodis

Mathematica can draw star charts for constellations, but when I tried

Entity["Constellation", "Orion"]["ConstellationGraphic"]

it produced extraneous text on top of the graphic.

Related posts

How to memorize the periodic table

Periodic table image


Memorizing the periodic table has some practical value, especially if you’re a chemist, but in any case it’s an interesting exercise, easier to do than it may sound. And it’s a case study for how you might memorize other things of more practical value to you personally.

Major system pegs

The Major system is a way to associate consonant sounds to numbers. You can fill in vowels and semivowels as you please to turn the sequence of consonant sounds into words, preferably words that create a vivid image in your mind.

You can pick a canonical encoding of each number to create a set of pegs and use these to memorize numbered lists. Although numbers can be encoded many ways, a set of pegs is a one-to-one mapping to numbers. To pull up the nth item in the list, recall what image you’ve associated with the peg image for n.

For example, you could encode 16 as dish, tissue, touché, Hitachi, etc. If you want to remember that sulfur has atomic number 16 you could use any of those images. But if you wanted to remember that the 16th element is sulfur, you need to have a unique peg associated with 16.

Learning pegs is more work than hanging things on pegs. But once you have a set of pegs, you can reuse them for memorizing multiple lists. For example, you could use the same pegs to memorize the periodic table and the ASCII table.

Atomic numbers

Allan Krill has written up a way to associate each element with a peg. You could use his suggestions, but you’ll almost certainly need to customize some of them. It’s generally hard to use anyone else’s mnemonics. What works for one person may not for another.

To memorize the periodic table, you first come up with pegs for the numbers 1 through 118. Practice those and get comfortable with them. This could take a while, but it’s reusable effort. Then associate an image of each element with its corresponding peg. For example, polonium is element 84. If your peg for 84 is fire, you might imagine someone playing polo on a field that’s on fire.

Element symbols

Every element has a one- or two-letter symbol, and most of these are easy: Ti for titanium, U for uranium, etc. Some seem completely arbitrary, such as Hg for mercury, but these you may already know. These names seem strange because they are mnemonic in Latin. But the elements with Latin names are also the ones that were discovered first and are the most common. You probably know by osmosis, for example, that the symbol for iron is Fe.

The hard part is the second letter, if there is a second letter. For example, is does Ar stand for argon or arsenic? Is the symbol for thulium Th or Tl or Tm?

When you associate an element image with a peg image, you could add a third image for the second letter of the element symbol, using the NATO phonetic alphabet if you know that. For example, the NATO word for S is Sierra. If your peg for 33 is mummy, you might imagine a mummy drinking a bottle of Sierra Springs® water laced with arsenic.

Related posts

Image from OpenStax Biology 2e. CC BY Attribution license.

Homework problems are rigged

This post is a follow-on to a discussion that started on Twitter yesterday. This tweet must have resonated with a lot of people because it’s had over 250,000 views so far.

You almost have to study advanced math to solve basic math problems. Sometimes a high school student can solve a real world problem that only requires high school math, but usually not.

There are many reasons for this. For one thing, formulating problems is a higher-level skill than solving them. Homework problems have been formulated for you. They have also been rigged to avoid complications. This is true at all levels, from elementary school to graduate school.

A college school student tutoring a high school student might notice that homework problems have been crafted to always have whole number solutions. The college student might not realize how his own homework problems have been rigged analogously. Calculus homework problems won’t avoid fractions, but they still avoid problems that don’t have tidy solutions [1].

When I taught calculus, I looked around for homework problems that were realistic applications, had closed-form solutions, and could be worked in a reasonable amount of time. There aren’t many. And the few problems that approximately satisfy these three criteria will be duplicated across many textbooks. I remember, for example, finding a problem involving calculating the mass of a star that I thought was good exercise. Then as I looked through a stack of calculus texts I saw that the same homework problem was in most if not all the textbooks.

But it doesn’t stop there. In graduate school, homework problems are still crafted to avoid difficulties. When you see a problem like this one it’s not obvious that the problem has been rigged because the solution is complicated. It may seem that you’re able to solve the problem because of the power of the techniques used, but that’s not the whole story. Tweak any of the coefficients and things may go from complicated to impossible.

It takes advanced math to solve basic math problems that haven’t been rigged, or to know how to do your own rigging. By doing your own rigging, I mean looking for justifiable ways to change the problem you need to solve, i.e. to make good approximations.

For example, a freshman physics class will derive the equation of a pendulum as

y″ + sin(y) = 0

but then approximate sin(y) as y, changing the equation to

y″ + y = 0.

That makes things much easier, but is it justifiable? Why is that OK? When is that OK, because it’s not always.

The approximations made in a freshman physics class cannot be critiqued using freshman physics. Working with the un-rigged problem, i.e. keeping the sin(y) term, and understanding when you don’t have to, are both beyond the scope of a freshman course.

Why can we ignore friction in problem 5 but not in problem 12? Why can we ignore the mass of the pulley in problem 14 but not in problem 21? These are questions that come up in a freshman class, but they’re not freshman-level questions.


[1] This can be misleading. Students often say “My answer is complicated; I must have made a mistake.” This is a false statement about mathematics, but it’s a true statement about pedagogy. Problems that haven’t been rigged to have simple solutions often have complicated solutions. But since homework problems are usually rigged, it is true that a complicated result is reason to suspect an error.

Alien astronomers and Benford’s law

alien astronomer image created by DALL-E

In 1881, astronomer Simon Newcomb noticed something curious. The first pages in books of logarithms were dirty on the edge, while the pages became progressively cleaner in later pages. He inferred from this that people more often looked up the logarithms of numbers with small leading digits than with large leading digits.

Why might this be? One might reasonably expect the numbers that came up in work to be uniformly distributed. But as often the case, it helps to ask “Uniform on what scale?”

Newcomb might have imagined his counterpart on another planet. This alien astronomer might have 12 fingers [1] and count in base 12. Base 10 is not inevitable, even for creatures with 10 fingers: the ancient Sumerians used a base-60 number system.

If Newcomb’s twelve-fingered counterpart had developed logarithms but not digital computers, he might have tables of duodecimal logarithms bound into books, and he too might noticed that pages with small leading (duo)digits are more frequently referenced. Both astronomers would naturally look up the logarithms of physical constants, physical distances, and so fort, numbers that vary over a practically unlimited range. The unlimited range is important.

On what scale could both astronomers see the leading digits uniformly distributed?

If Newcomb needed to look up the logarithms of numbers over a limited range, say from 1 to 106, each with equal probability, then the leading digits would be uniformly distributed. But our alien astronomer would have no special interest in the number 106. He might want to look at numbers between 1 and 126. The leading digits of numbers over this range would be uniformly distributed when represented in base 12, but not when represented in base 10. The choice of upper limit introduces a bias in one base or another.

Now suppose the numbers that both astronomers used in their work were uniformly distributed on a logarithmic scale. Newcomb conjectured that the numbers that came up in practice were uniformly distributed in their logarithms base 10. Our alien astronomer might conjecture the same thing for logarithms base 12. And both could be right. So would a third astronomer working in base 42. All logarithms are proportional, and so numbers uniformly distributed on a log scale using one base are uniformly distributed on a log scale using any other base.

Benford’s law says that the leading digits of numbers that come up in practice are uniformly distributed on a log scale. This applies to base 10, but also any other base, such as base 100. If you looked at the first two digits and thought of them as single base-100 digits, Benford’s law still applies.

But who is Benford? True to Stigler’s law of eponymy, Newcomb’s observation is named after physicist Frank Benford who independently made the same observation in 1938 and who tested it more extensively.

Let’s look at a set of physical constants and see how well Benford’s law applies. I took at list of physical constants from NIST and made a histogram of the leading digits to compare with what one would expect from Benford’s law.

If one were to write the NIST constants in base 12 and repeat the exercise, the result would look similar.

Related posts

[1] The image at the top of the post was created by DALL-E. There is a slight hint of an extra finger. DALL-E usually has a hard problem with hands, adding or removing fingers. But my attempts to force it to draw a hand with an extra finger were not successful.

Oval orbits?

Johannes Kepler thought that planetary orbits were ellipses. Giovanni Cassini thought they were ovals. Kepler was right, but Cassini wasn’t far off.

In everyday speech, people use the words ellipse and oval interchangeably. But in mathematics these terms are distinct. There is one definition of an ellipse, and several definitions of an oval. To be precise, you have to say what kind of oval you have in mind, and in the context of this post by oval I will always mean a Cassini oval.

Ellipses and ovals each have two foci, f1 and f2. Let d1(p) and d2(p) be the distances from a point p to each of the foci. For an ellipse, the sum d1(p) + d2(p) is constant. For an oval, the product d1(p) d2(p) is constant.

In [1] the authors argue that just as planetary orbits are nearly circles, they’re also nearly ovals. This post will look at how far the earth’s orbit is from a circle and from an oval.

We need a way to specify which oval we want to compare to the ellipse of earth’s orbit. We’ll do this by equating the major and minor semi-axes of the two curves. These are usually denoted a and b, but the same variables have a different meaning in the context of ovals, so I’ll denote them by M for major and m for minor.

The equation of an ellipse is

(x/M)² + (y/m)² = 1

and the equation of an oval is

((x + a)² + y²) ((xa)² + y²) = b².

Setting x = 0 in the equation of an oval tells us

m² = ba²

and setting y = 0 tells us

M² = b + a².


b = (M² + m²)/2


a² = (M² – m²)/2.

For the earth’s orbit, M = 1.00000011 and m = 0.99986048 measured in AU, astronomical units. So or oval has parameters

a = 0.011816102


b = 0.99986060.

If you plot Kepler’s ellipse and Cassini’s oval for earth’s orbit at the same time, you can’t see the difference.

Planet orbits are nearly circular. If we compare a circle of radius 1 AU with Kepler’s ellipse we get a maximum error of about 1 part in 10,000.

But if we compare Cassini’s oval with Kepler’s ellipse we get a maximum error of about 1 part in 100,000,000.


In short, a circle is a good approximation to earth’s orbit, but a Cassini oval is four orders of magnitude better.

It would be difficult to empirically distinguish an ellipse from an oval as the shape of earth’s orbit, but theory is clearly on Kepler’s side since his ellipses fall out of Newton’s laws. Cassini’s error was more qualitative than quantitative.

More orbital mechanics posts

[1] Kepler’s ellipse, Cassini’s oval and the trajectory of planets. B Morgado1 and V Soares. 2014 Eur. J. Phys. 35 025009 DOI 10.1088/0143-0807/35/2/025009

Sphere of influence

Apollo 11 orbit diagram via NASA

Suppose a spaceship is headed from the earth to the moon. At some point we say that the ship has left the earth’s sphere of influence is now in the moon’s sphere of influence (SOI). What does that mean exactly?

Wrong explanation #1

One way you’ll hear it described is that the moon’s sphere of influence is the point at which the earth is no longer pulling on the spaceship, but that’s nonsense. Everything has some pull on everything else, so how do you objectively say the earth’s pull is small enough that we’re now going to call it zero? And as we’ll see below, the earth’s pull is still significant even when the spaceship leaves earth’s SOI.

Wrong explanation #2

Another explanation you’ll hear is the moon’s sphere of influence is the point at which the moon is pulling on the spaceship harder than the earth is. That’s a better explanation, but still not right.

The distance from the earth to the moon is about 240,000 miles, and the radius of the moon’s SOI is about 40,000 miles. So when a spaceship first enters the moon’s SOI, it is five times closer to the moon than to the earth.

Newton’s law of gravity says gravitational force between two bodies is proportional to the product of their masses and inversely proportional to the square of the distance. The mass of the earth is about 80 times that of the moon. So at the moon’s SOI boundary, the pull of the earth is 80/25 times as great as that of the moon, about three times greater.

Correct exlanation

So what does sphere of influence mean? The details are a little complicated, but essentially the moon’s sphere of influence is the point at which it’s more accurate to say the ship is orbiting the moon than to say it is orbiting the earth.

How can we say it’s better to think of the ship orbiting the moon than the earth when the earth is pulling on the ship three times as hard as the moon is? What matters is not so much the force of earth’s gravity as the effect of that force on the equations of motion.

The motion of an object between the earth and the moon could be viewed as an orbit around earth, with the moon exerting a perturbing influence, or as an orbit around the moon, with the earth exerting a perturbing influence.

At the boundary of the moon’s SOI the effect of the earth perturbing the ship’s orbit around the moon is equal to the effect of the moon perturbing its orbit around the earth. It’s a point at which it is convenient to switch perspectives. It’s not a physical boundary [1]. Also, the “sphere” of influence is not exactly a sphere but an approximately spherical region.

The moon has an effect on the ship’s motion when it’s on our side of the moon’s SOI, and the earth still has an effect on its motion after it has crossed into the moon’s SOI.

Calculating the SOI radius

As a rough approximation, the SOI boundary is where the ratio of the distances to the two bodies, e.g. moon and earth, equals the ratio of their masses to the exponent 2/5:

r/R = (m/M)2/5.

This approximation is better when the mass M is much larger than the mass m. For the earth and the moon, the equation is good enough for back-of-the-envelope equations but not accurate enough for planning a mission to the moon. Using the round numbers in this post, the left side of the equation is 1/5 = 0.2 and the right side is (1/80)0.4 = 0.17.


Everything above has been in the context of the earth-moon system. Sphere of influence is defined relative to two bodies. When we spoke of a spaceship leaving the earth’s sphere of influence, we implicitly meant that it was leaving the earth’s sphere of influence relative to the moon.

Relative to the sun, the earth’s sphere of influence reaches roughly 600,000 miles. You could calculate this distance using the equation above. A spaceship like Artemis leaves the earth’s sphere of influence relative to the moon at some point, but never leaves the earth’s sphere of influence relative to the sun.

Related posts

[1] The sphere of influence sounds analogous to a continental divide, where rain falling on one side of the line ends up in one ocean and rain falling on the other side ends up in another ocean. But it’s not that way. I suppose you could devise an experiment to determine which side of the SOI you’re on, but it would not be a simple experiment. An object placed between the earth and the moon at the SOI boundary would fall to the earth unless it had sufficient momentum toward the moon.

The Pluto-Charon orbit

The Moon doesn’t orbit the center of the Earth; it orbits the center of mass of the Earth-Moon system, which is inside the Earth. The distinction matters for designing satellite orbits, but it cannot be seen on a plot to scale. We’ll quantify this below.

Pluto’s moon Charon, however, is so large relative to Pluto and so close, that the center of mass of the Pluto-Charon system is outside of Pluto, and you can easily see this in a plot.

Plot of Pluto and Charon orbiting their barycenter

Imagine Pluto and Charon sitting on each end of a balanced seesaw. Pluto is a distance x1 to the left of the fulcrum, and Charon is a distance x2 to the right of the fulcrum. Let m1 be the mass of Pluto and m2 be the mass of Charon. Then

m1 x1 = m2 x2


x1 = m2 (x1 + x2) / (m1 + m2).

Now let’s put in some numbers.

m1 = 1.309 × 1022 kg
m2 = 1.62 × 1021 kg
x1 + x2 = 19,640 km

From this we find

x1 = (1.62 × 19640 / 14.71) km = 2163 km

and so the distance from the center of Pluto to the center of mass of the Pluto-Charon system is 2163 km. But the radius of Pluto is only 1190 km. So the center of mass of the Pluto-Charon system is about as far above the surface of Pluto as the center of Pluto is below the surface.

Comparison with the Earth-Moon system

It matters that the moon doesn’t exactly orbit the center of the Earth, but the difference between the center of the Earth and the center of mass of the Earth-Moon system is less dramatic. Let’s put in the numbers for the Earth and Moon.

m1 = 5.97 × 1024 kg
m2 = 7.346 × 1022 kg
x1 + x2 = 392,600 km

From this we find

x1 = (7.346 × 392,600 / 604) km = 4,775 km

The radius of Earth is 6,371 km, and so the center of mass of the Earth-Moon system is inside the Earth.

I made a plot analogous to the one above but for the Earth-Moon system. You could barely see the moon because it is so small relative to the size of its orbit. And you cannot see the difference between the center of the Earth and the barycenter of the Earth and Moon.

Tidal locking

Not only is Charon tidally locked with Pluto, as our moon is with Earth, but Pluto is tidally locked with Charon as well.

On Earth we only ever see one side of the moon. We never see the “dark side,” which is more accurately the “far side.” But someone standing on the moon would see Earth rotate.

Someone standing on Pluto would only ever see one side of Charon, and someone standing on Charon would only ever see one side of Pluto. Sputnik Planitia, the big heart-shaped feature on Pluto, is on the opposite side of Charon, so you could say Pluto is hiding its heart from its companion.

Image of Pluto featuring heart-shaped region

More orbital mechanics posts

Shape of moon orbit around sun

The earth’s orbit around the sun is nearly a circle, and the moon’s orbit around the earth is nearly a circle, but what is the shape of the moon’s orbit around the sun?

You might expect it to be bumpy, bending inward when the moon is between the earth and the sun and bending output when the moon is on the opposite side of the earth from the sun. But in fact the shape of the moon’s orbit around the sun is convex as proved in [1] and illustrated below.

If the moon orbited the earth much faster, say 10 times faster, at the same altitude, then we see that the orbit is indeed bumpy.

However, the nothing could orbit the earth 10x faster than the moon at the same distance as the moon. Orbital period determines altitude and vice versa.

A more realistic example would be a satellite in MEO (Medium Earth Orbit) like a GPS satellite. Such a satellite orbits the earth roughly twice a day. The path of a MEO satellite around the sun is not convex.

The plot above shows about one day of an MEO satellite’s orbit around the sun. Note that the vertical and horizontal scales are not the same; it would be hard to see anything but a flat line if the scales were the same because the satellite is far closer to the earth than the sun.

Here are the equations from [1]. Choose units so that the distance to the moon or satellite is 1 and let d be the distance from the planet to the sun. Let p be the number of times the moon or satellite orbits the planet as the planet orbits the sun (the number of sidereal periods).

x(θ) = d cos(θ) + cos(pθ)
y(θ) = d sin(θ) + sin(pθ)

This assumes both the planet’s orbit around the sun and the satellite’s orbit around the planet are circular, which is a good approximation in our examples.

[1] Noah Samuel Brannen. The Sun, the Moon, and Convexity. The College Mathematics Journal, Vol. 32, No. 4 (Sep., 2001), pp. 268-272

Can Brownian motion do work?

According to the latest episode of Eclectic Tech, Richard Feynman argued that Brownian motion cannot do work, but researchers at the University of Arkansas have demonstrated that it can by generating an electric current from Brownian motion in a sheet of graphene. You can read more in the physics journal article by the researchers.

Unfortunately this will be the last episode of Eclectic Tech. This last episode had several interesting stories. In addition to the story above, the episode discussed synchronizing clocks by observing cosmic ray events, a new bioinspired metamaterial, and NASA’s Inspire project.

More on Brownian motion

Infinite periodic table

All the chemical elements discovered or created so far follow a regular pattern in how their electrons are arranged: the nth shell contains up to 2n – 1 suborbitals that each contain up to two electrons. For a given atomic number, you can determine how its electrons are distributed into shells and suborbitals using the Aufbau principle.

The Aufbau principle is a good approximation, but not exact. For this post we’ll assume it is exact, and that everything in the preceding paragraph generalizes to an arbitrary number of shells and electrons.

Under those assumptions, what would the periodic table look like if more elements are discovered or created?

D. Weiss worked out the recurrence relations that the periods of the table satisfy and found their solutions.

The number of elements in nth period works out to

   P_n = \frac{(-1)^n(2n+3) + 2n^2 + 6n + 5}{4}

and the atomic numbers of the elements at the end of the nth period (the noble gases) are

Z_n = \frac{(-1)^n(3n+6) + 2n^3 + 12n^2 + 25n - 6}{12}

We can verify that these formulas give the right values for the actual periodic table as follows.

    >>> def p(n): return ((-1)**n*(2*n+3) + 2*n*n + 6*n +5)/4
    >>> def z(n): return ((-1)**n*(3*n+6) + 2*n**3 + 12*n**2 + 25*n - 6)/12
    >>> [p(n) for n in range(1, 8)]
    [2.0, 8.0, 8.0, 18.0, 18.0, 32.0, 32.0]
    >>> [z(n) for n in range(1, 8)]
    [2.0, 10.0, 18.0, 36.0, 54.0, 86.0, 118.0]

So, hypothetically, if there were an 8th row to the periodic table, it would contain 50 elements, and the last element of this row would have atomic number 168.