Feed john-d-cook John D. Cook

Favorite IconJohn D. Cook

Link https://www.johndcook.com/blog
Feed http://feeds.feedburner.com/TheEndeavour?format=xml
Updated 2025-04-26 03:16
The NBA and MLB trees are isomorphic
An isomorphism is a structure-preserving function from one object to another. In the context of graphs, an isomorphism is a function that maps the vertices of one graph onto the vertices of another, preserving all the edges. So if G and H are graphs, and f is an isomorphism between G and H, nodes x […]The post The NBA and MLB trees are isomorphic first appeared on John D. Cook.
Numbering minor league baseball teams
Last week I wrote about how to number MLB teams so that the number n told you where they are in the league hierarchy: n % 2 tells you the league, American or National n % 3 tells you the division: East, Central, or West n % 5 is unique within a league/division combination. Here […]The post Numbering minor league baseball teams first appeared on John D. Cook.
John Conway’s mental factoring method and friends
There are tricks for determining whether a number is divisible by various primes, but many of these tricks have to be applied one at a time. You can make a procedure for testing divisibility by any prime p that is easier than having to carry out long division, but these rules are of little use […]The post John Conway’s mental factoring method and friends first appeared on John D. Cook.
Major League Baseball and number theory
The previous post took a mathematical look at the National Football League. This post will do the same for Major League Baseball. Like the NFL, MLB teams are organized into a nice tree structure, though the MLB tree is a little more complicated. There are 32 NFL teams organized into a complete binary tree, with […]The post Major League Baseball and number theory first appeared on John D. Cook.
A mathematical look at the NFL
This post will look at the National Football League through the lens of graph theory, topology, and binary numbers. The NFL has a very nice tree structure, which isn’t too surprising in light of the need to make tournament brackets. The NFL is divided into two conferences, the American Football Conference and the National Football […]The post A mathematical look at the NFL first appeared on John D. Cook.
How Mr. Benjamin squares numbers
This post is a sequel to the post How Mr. Bidder calculated logarithms published a few days ago. As with that post, this post is based on an excerpt from The Great Mental Calculators by Steven B. Smith. Smith’s book says Arthur Benjamin squares large numbers using the formula n² = (n + a)(n − […]The post How Mr. Benjamin squares numbers first appeared on John D. Cook.
Bounding derivatives of the sinc function
The sinc function is defined either as sin(x)/x or as sin(πx)/πx. We’ll use the former definition here because we’ll cite a paper that uses that definition. Here’s a plot of the sinc function and its first two derivatives. Thomas Grönwall proposed a problem to the American Mathematical Monthly in 1913 [1] bounding the derivatives of […]The post Bounding derivatives of the sinc function first appeared on John D. Cook.
Another Napoleon-like theorem
A little while back I wrote about Napoleon’s theorem for triangles. A little later I wrote about Van Aubel’s theorem, a sort of analogous theorem quadrilaterals. This post presents another analog of Napoleon’s theorem for quadrilaterals. Napoleaon’s theorem says that if you start with any triangle, and attach equilateral triangles to each side, the centroids […]The post Another Napoleon-like theorem first appeared on John D. Cook.
Playfair cipher
The Playfair cipher was the first encryption technique to encrypt text two letters at a time. Instead of substituting one letter for another, it substitutes one pair of letters for another pair. This makes the method more secure than a simple substitution cipher, but hardly secure by modern standards. The Playfair cipher was used (and […]The post Playfair cipher first appeared on John D. Cook.
Simple substitution ciphers over a gargantuan alphabet
Simple substitution ciphers replace one letter with another. Maybe A goes to W, B goes to G, C goes to A, etc. These ciphers are famously easy to break, so easy that they’re common in puzzle books. Here’s one I made [1] for this post in case you’d like to try it. X RF SXIIXKW […]The post Simple substitution ciphers over a gargantuan alphabet first appeared on John D. Cook.
How Mr. Bidder calculated logarithms
George Parker Bidder (1806–1878) was a calculating prodigy. One of his feats was mentally calculating logarithms to eight decimal places. This post will explain his approach. I’ll use “log” when the base of the logarithm doesn’t matter, and add a subscript when it’s necessary to specify the base. Bidder was only concerned with logarithms base […]The post How Mr. Bidder calculated logarithms first appeared on John D. Cook.
Sine of integers
The sine function has period 2π, an irrational number. and so if we take the sines of the integers, we’re going to get a somewhat random sequence. (I’m assuming, as always that we’re working in radians. The sines of integer numbers of degrees are much less interesting.) Here’s a plot of the sines of 0, […]The post Sine of integers first appeared on John D. Cook.
Derive or memorize?
A lot of smart people have a rule not to memorize anything that they can derive on the spot. That’s a good rule, up to a point. But past that point it becomes a liability. Most students err on the side of memorizing too much. For example, it’s common for students to memorize three versions […]The post Derive or memorize? first appeared on John D. Cook.
Divisibility by base + 1
To test whether a number is divisible by 11, add every other digit together and subtract the rest of the digits. The result is divisible by 11 if and only if the original number is divisible by 11. For example, start with n = 31425. Add 3, 4, and 5, and subtract 1 and 2. […]The post Divisibility by base + 1 first appeared on John D. Cook.
How large is a Maidenhead field?
The Maidenhead locator system divides the earth into fields, squares, and subsquares. The first two characters in a Maidenhead locator specify the square. These are letters A through R representing 20 degrees of longitude or 10 degrees of latitude. Latitude A runs from the South Pole to 80° south of the equator. Latitude R runs […]The post How large is a Maidenhead field? first appeared on John D. Cook.
Area of a “rectangle” on a globe
What do we mean by rectangle? This post will derive the area of a spherical region bounded by lines of latitude and longitude. Such a region corresponds to an actual rectangle on a Mercator projection map, with sides aligned with the coordinate axes, and is approximately a rectangle on a sphere if the rectangle is […]The post Area of a “rectangle” on a globe first appeared on John D. Cook.
F# and G
I was looking at frequencies of pitches and saw something I hadn’t noticed before: F# and G have very nearly integer frequencies. To back up a bit, we’re assuming the A above middle C has frequency 440 Hz. This is the most common convention now, but conventions have varied over time and place. We’re assuming […]The post F# and G first appeared on John D. Cook.
How well does a spline fit a function?
Suppose you’re going to fit a spline s to a function f by interpolating f at a number of points. What can you know a priori about how well s will approximate f? This question was thoroughly resolved five decades ago [1], but the result is a bit complicated, so we’ll incrementally work our way […]The post How well does a spline fit a function? first appeared on John D. Cook.
The Pearson distributions
The previous post was about 12 probability distributions named after Irving Burr. This post is about 12 probability distributions named after Karl Pearson. The Pearson distributions are better known, and include some very well known distributions. Burr’s distributions are defined by their CDFs; Pearson’s distributions are defined by their PDFs. Pearson’s differential equation The densities […]The post The Pearson distributions first appeared on John D. Cook.
The other Burr distributions
As I mentioned in the previous post, there are 12 distributions named for Irving Burr, known as Burr Type I, Burr Type II, Burr Type III, …, Burr Type XII. [1] The last of these is by far the most common, and the rest are hard to find online. I did manage to find them, […]The post The other Burr distributions first appeared on John D. Cook.
Burr distribution
Irving Burr came up with a set of twelve probability distributions known as Burr I, Burr II, …, Burr XII. The last of these is by far the best known, and so the Burr XII distribution is often referred to simply as the Burr distribution [1]. See the next post for the rest of the […]The post Burr distribution first appeared on John D. Cook.
Quasiperiodic functions
This post will distinguish between periodic, almost periodic, and quasiperiodic functions, and give examples of the latter. Definitions A function f is periodic with period T if f(x + T) = f(x) for all x. For example, trig functions are periodic. A function f is almost periodic with period T if f(x + T) ≈ […]The post Quasiperiodic functions first appeared on John D. Cook.
Rotating multiples of 37
If a three-digit number is divisible by 37, it remains divisible by 37 if you rotate its digits. For example, 148 is divisible by 37, and so are 814 and 481. This rotation property could make it easier to recognize multiples of 37 or easier to carry out trial division. Before proving the theorem, I’ll […]The post Rotating multiples of 37 first appeared on John D. Cook.
Recognizing squares
Suppose you’re given a number and you’d like to tell whether its a square, or at least you’d like to be able to determine quickly if it’s not a square. This post began as a thread I wrote on Twitter. For starters, the last digit of a square in base 10 must be 0, 1, […]The post Recognizing squares first appeared on John D. Cook.
Hénon’s dynamical system
This post will reproduce a three plots from a paper of Hénon on dynamical systems from 1969 [1]. Let α be a constant, and pick some starting point in the plane, (x0, y0), then update x and y according to xn+1 = xn cos α − (yn − xn²) sin α yn+1 = xn sin […]The post Hénon’s dynamical system first appeared on John D. Cook.
Mediant approximation trick
Suppose you are trying to approximate some number x and you’ve got it sandwiched between two rational numbers: a/b < x < c/d. Now you’d like a better approximation. What would you do? The obvious approach would be to take the average of a/b and c/d. That’s fine, except it could be a fair amount […]The post Mediant approximation trick first appeared on John D. Cook.
Lagrange multiplier setup: Now what?
Suppose you need to optimize, i.e. maximize or minimize, a function f(x). If this is a practical problem and not a textbook exercise, you probably need to optimize f(x) subject to some constraint on x, say g(x) = 0. Hmm. Optimize one function subject to a constraint given by another function. Oh yeah, Lagrange multipliers! […]The post Lagrange multiplier setup: Now what? first appeared on John D. Cook.
Avoid having to integrate by parts twice
Suppose f(x) and g(x) are functions that are each proportional to their second derivative. These include exponential, circular, and hyperbolic functions. Then the integral of f(x) g(x) can be computed in closed form with a moderate amount of work. The first time you see how such integrals are computed, it’s an interesting trick. I wrote […]The post Avoid having to integrate by parts twice first appeared on John D. Cook.
Good autocomplete
I’m not sure whether automatic text completion on a mobile device is a net good. It sometimes saves a few taps, but it seems like it’s at least as likely to cause extra work. Although I’m ambivalent about autocomplete on my phone, I like it in my text editor. The difference is that in my […]The post Good autocomplete first appeared on John D. Cook.
Small-scale automation
Saving keystrokes is overrated, but maintaining concentration is underrated. This post is going to look at automating small tasks in order to maintain concentration, not to save time. If a script lets you easily carry out some ancillary task without taking your concentration off your main task, that’s a big win. Maybe the script only […]The post Small-scale automation first appeared on John D. Cook.
Remove algorithmic filters from what you read
I typically announce new blog posts from my most relevant twitter account: data science from @DataSciFact, algebra and miscellaneous math from @AlgebraFact, TeX and typography from @TeXtip, etc. If you’d like to be sure that you’re notified of each post, regardless of what algorithms Twitter applies to your feed, you can subscribe to this blog […]The post Remove algorithmic filters from what you read first appeared on John D. Cook.
Number of bits in a particular integer
When I think of bit twiddling, I think of C. So I was surprised to read Paul Khuong saying he thinks of Common Lisp (“CL”). As always when working with bits, I first doodled in SLIME/SBCL: CL’s bit manipulation functions are more expressive than C’s, and a REPL helps exploration. I would not have thought […]The post Number of bits in a particular integer first appeared on John D. Cook.
Lemniscate of Bernoulli
The lemniscate of Bernoulli came up in a post a few days ago. This shape is a special case of a Cassini oval: ((x + a)² + y²) ((x – a)² + y²) = a4. Here’s another way to arrive at the lemniscate. Draw a hyperbola (blue in the figure below), then draw circles centered […]The post Lemniscate of Bernoulli first appeared on John D. Cook.
Van Aubel’s theorem
Van Aubel’s theorem is analogous to Napoleon’s theorem, though not a direct generalization of it. Napoleon’s theorem says to start with any triangle and draw equilateral triangles on each side. Connect the centers of the three new triangles, and you get an equilateral triangle. Now suppose you start with a quadrilateral and draw squares on […]The post Van Aubel’s theorem first appeared on John D. Cook.
Pythagorean triangles with side 2023
Can a Pythagorean triangle have one size of length 2023? Yes, one possibility is a triangle with sides (2023, 6936, 7225). Where did that come from? And can we be more systematic, listing all Pythagorean triangles with a side of length 2023? Euclid’s formula generates Pythagorean triples by sticking integers m and n into the […]The post Pythagorean triangles with side 2023 first appeared on John D. Cook.
Heat equation and the normal distribution
The density function of a normal distribution with mean 0 and standard deviation √(2kt) satisfies the heat equation. That is, the function satisfies the partial differential equation You could verify this by hand, or if you’d like, here’s Mathematica code to do it. u[x_, t_] := PDF[NormalDistribution[0, Sqrt[2 k t]], x] Simplify[ D[u[x, t], {t, […]The post Heat equation and the normal distribution first appeared on John D. Cook.
Airfoils
Here’s something surprising: You can apply a symmetric function to a symmetric shape and get something out that is not symmetric. Let f(z) be the average of z and its reciprocal: f(z) = (z + 1/z)/2. This function is symmetric in that it sends z and 1/z to the same value. It’s also symmetric in […]The post Airfoils first appeared on John D. Cook.
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 […]The post Oval orbits? first appeared on John D. Cook.
Cassini ovals
An ellipse can be defined as the set of points such that the sum of the distances to two fixed points, the foci, has a constant value. A Cassini oval is the set of points such that the product of the distances to two foci has a constant value. You can write down an equation […]The post Cassini ovals first appeared on John D. Cook.
Bounds on power series coefficients
Let f be an analytic function on the unit disk with f(0) = 0 and derivative f ′(0) = 1. If f is one-to-one (injective) then this puts a strict limit on the size of the series coefficients. Let an be the nth coefficient in the power series for f centered at 0. If f is one-to-one […]The post Bounds on power series coefficients first appeared on John D. Cook.
Probability problem with Pratt prime proofs
In the process of creating a Pratt certificate to prove that a number n is prime, you have to find a number a that seems kinda arbitrary. As we discussed here, a number n is prime if there exists a number a such that an-1 = 1 mod n and a(n-1)/p ≠ 1 mod n […]The post Probability problem with Pratt prime proofs first appeared on John D. Cook.
Factoring b^n + 1
The previous post illustrated a technique for finding factors of number of the form bn – 1. This post will look at an analogous, though slightly less general, technique for numbers of the form bn + 1. There is a theorem that says that if m divides n then bm + 1 divides bn + […]The post Factoring b^n + 1 first appeared on John D. Cook.
Factoring b^n – 1
Suppose you want to factor a number of the form bn – 1. There is a theorem that says that if m divides n then bm – 1 divides bn – 1. Let’s use this theorem to try to factor J = 22023 – 1, a 609-digit number. Factoring such a large number would be more difficult if it didn’t have […]The post Factoring b^n – 1 first appeared on John D. Cook.
Converting between barycentric and trilinear coordinates
Barycentric coordinates describe the position of a point relative to the three vertices of a triangle. Trilinear coordinates describe the position of a point relative to the three sides of a triangle. It’s surprisingly simple to convert from one to the other. Why should this be surprising? Because the distance from a point to a […]The post Converting between barycentric and trilinear coordinates first appeared on John D. Cook.
Special primality proofs
I’ve written lately about two general ways to prove that a number is prime: Pratt certificates for moderately-large primes and elliptic curve certificates for very large primes. If you can say more about the prime you wish to certify, there may be special forms of certificates that are more efficient. In particular, there are efficient […]The post Special primality proofs first appeared on John D. Cook.
Zeta sum vs zeta product
The Riemann zeta function ζ(s) is given by an infinite sum and an infinite product for complex numbers s with real part greater than 1 [*]. The infinite sum is equal to the infinite product, but which would give you more accuracy: N terms of the sum or N terms of the product? We’ll take […]The post Zeta sum vs zeta product first appeared on John D. Cook.
Approximating pi with Bernoulli numbers
In a paper on arXiv Simon Plouffe gives the formula which he derives from an equation in Abramowitz and Stegun (A&S). It took a little while for me to understand what Plouffe intended. I don’t mean my remarks here to be criticism of the author but rather helpful hints for anyone else who might have […]The post Approximating pi with Bernoulli numbers first appeared on John D. Cook.
Reverse engineering options
This weekend I saw a sign in the window of a Burger King™ that made me think of an interesting problem. If you know the number of possibilities like this, how would you reverse engineer what the options that created the possibilities? In the example above, there are 211,184 = 213×33 possible answers, and so […]The post Reverse engineering options first appeared on John D. Cook.
Foreshadowing Page Rank
Douglas Hofstadter, best known as the author of Godel, Escher, Bach, wrote the foreword to Clark Kimberling’s book Triangle Centers and Central Triangles. Hofstadter begins by saying that in his study of math he “sadly managed to sidestep virtually all of geometry” and developed an interest in geometry, specifically triangle centers, much later. The ancient […]The post Foreshadowing Page Rank first appeared on John D. Cook.
Third order ordinary differential equations
Most applied differential equations are second order. This probably has something to do with the fact that Newton’s laws are second order differential equations. Higher order equations are less common in application, and when they do pop up they usually have even order, such as the 4th order beam equation. What about 3rd order equations? […]The post Third order ordinary differential equations first appeared on John D. Cook.
...10111213141516171819...