All the data you need.

## Tag: Mathematica

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 …
A disk around Paris
The other day I saw an image of a large disk centered on Paris subjected to the Mercator projection. I was playing around in Mathematica and made similar images for different projections. Each image below is a disk of radius 4200 km centered on Paris (latitude 49°, longitude 2°). All …
Curvature: principal, Gauss, and mean
This post will compute the center of curvature for an object described in the previous post. In order to do that we first need to describe principle curvature and Gauss curvature, and we’ll throw in mean curvature while we’re at it. Let S be a surface sitting in three dimensional …
Checksum polynomials
A large class of checksum algorithms have the following pattern: Think of the bits in a file as the coefficients in a polynomial P(x). Divide P(x) by a fixed polynomial Q(x) mod 2 and keep the remainder. Report the remainder as a sequence of bits. In practice there’s a little …
Curvature at Cairo
I was flipping through Gravitation [1] this weekend and was curious about an illustration on page 309. This post reproduces that graph. The graph is centered at Cairo, Egypt and includes triangles whose side lengths are the distances between cities. The triangles are calculated using only distances, not by measuring …
Creating a Traveling Salesman Tour of Texas with Mathematica
A Traveling Salesman tour visits a list of destinations using the shortest path. There’s an obvious way to find the shortest path connecting N points: try all N! paths and see which one is shortest. Unfortunately, that might take a while. Texas has 254 counties, and so calculating a tour …
Cayley graphs in Mathematica
The previous post mentioned the group S4, the group of all permutations of a set with four elements. This post will show a way to visualize this group. The Mathematica command CayleyGraph[ SymmetricGroup[4], VertexLabels -> Placed["Name", Center], VertexSize -> 0.4] generates the graph below. This is an interesting image, but …
Permutations and centralizers in Mathematica
I had a fleeting thought about how little I use group theory when I realize I used it just this week. A couple days ago I needed to know which permutations of 4 elements commute with reversal. If r takes a sequence and reverses it, I need to find all …
Drag equation exponent variation
The motion of a falling body of mass m is given by where the term −kvr accounts for drag due to air resistance. One can derive r = 2 under simple physical assumptions, but if I remember correctly other values of r may be more realistic in certain circumstances. I …
Double duals of polyhedra
The previous post mentioned the dual of a tetrahedron is another tetrahedron. The dual of a cube is an octahedron and the dual of an octahedron is a cube. And the dual of a dodecahedron is an icosahedron, and the dual of an icosahedron is a dodecahedron. So if you …
Poisson distribution tail bounds
Yesterday Terence Tao published a blog post on bounds for the Poisson probability distribution. Specifically, he wrote about Bennett’s inequalities and a refinement that he developed or at least made explicit. Tao writes This observation is not difficult and is implicitly in the literature … I was not able to …
Jacobi functions with complex parameter
Jacobi functions are complex-valued functions of a complex variable z and a parameter m. Often this parameter is real, and 0 ≤ m < 1. Mathematical software libraries, like Python’s SciPy, often have this restriction. However, m could be any complex number. The previous couple of posts spoke of the …
When a cubic or quartic has a double root
Thanks to the quadratic equation, it’s easy to tell whether a quadratic equation has a double root. The equation has a double root if and only if the discriminant is zero. The discriminant of a cubic is much less known, and the analogs for higher order polynomials are unheard of. …
Three interesting curves
Here are three curves that have interesting names and interesting shapes. The fish curve The fish curve has parameterization x(t) = cos(t) – sin²(t)/√2 y(t) = cos(t) sin(t) We can plot this curve in Mathematica with ParametricPlot[ {Cos[t] - Sin[t]^2/Sqrt[2], Cos[t] Sin[t]}, {t, 0, 2 Pi}] to get the following. …
Average digit sum
Suppose you write down a number and take the sum of its digits. In what base will this sum be the smallest on average? Let’s do a couple examples comparing base 10 and base 2. The number 2022 in base 10 has digit sum 6, but its binary equivalent 11111100110 …
Quirks in Mathematica’s administrative division data for Mexico
If you ask Mathematica for a list of Mexican states via CountryData["Mexico", "RegionNames"] you will get a list of strings: "Aguascalientes", "Baja California", ..., "Zacatecas"} However, when you try to turn this into a list of objects representing these states via states = Entity["AdministrativeDivision", {#, "Mexico"}] & /@ CountryData["Mexico", "RegionNames"] …
Costas arrays in Mathematica
A couple days ago I wrote about Costas arrays. In a nutshell, a Costas array of size n is a solution to the n rooks problem, with the added constraint that if you added wires between the rooks, no two wires would have the same length and slope. See the …
Finding similar world flags with Mathematica
A week ago I posted some pairs of similar flags on Twitter, and later I found that Mathematica’s CountryData database contains flag descriptions. So I thought I’d use the flag descriptions to see which flags Mathematica things are similar. For example, the FlagDescription attribute for Chad in Mathematica is Three …