John D. Cook Consulting Blog

8,480 FOLLOWERS

The Endeavor gives readers a sense of how they might combine their programming skills with business, and/or use those skills to solve real-world problems. It is the popular computer science-themed blog of John Cook, a former math professor and programmer who has transitioned into consulting. He helps companies make better decisions by taking advantage of the data they have, combining it with..

John D. Cook Consulting Blog

18h ago

The numbers in today’s date—11, 28, and 23—make up the sides of a triangle. This doesn’t always happen; the two smaller numbers have to add up to more than the larger number.
We’ll look at triangles with sides 11, 23, and 28 in the plane, on a sphere, and on a hypersphere. Most of the post will be devoted to the middle case, a large triangle on the surface of the earth.
Solving a triangle in the plane
If we draw a triangle with sides 11, 23, and 28, we can find out the angles of the triangle using the law of cosines:
c² = a² + b² – 2ab cos C
where C is the angle opposite the side c. We can fin ..read more

John D. Cook Consulting Blog

2d ago

If you knew that you wanted to learn 10 spoken languages, it would probably be helpful to take a course in linguistics first. Or maybe to have a linguistics course after learning your first or second language. And if the languages are related, it would help to know something about the linguistics of that group of languages in particular. For example, if you wanted to learn several Romance languages, it might be worthwhile to learn at least some Latin first, even if Latin isn’t on the list of languages you want to learn.
In order to become fluent in using the Unix (Linux) command line, you need ..read more

John D. Cook Consulting Blog

2d ago

Richard Hamming [1] gives this nice example of an integral with a mild singularity:
The integrand approaches −∞ as x approaches 0 and yet the integral is finite. If we try into numerically evaluate this integral, we will either get inaccurate results or we will have to go to a lot of work.
This post will show that with a clever reformulation of the problem we use simple methods to get accurate results, or use sophisticated methods with fewer function evaluations.
As I wrote about years ago, a common technique for dealing with singularities is to add and subtract a function with the same asymp ..read more

John D. Cook Consulting Blog

2d ago

When you stretch a coiled spring, the radius decreases slightly, so slightly that you can’t see the difference unless you stretch the spring so much that you damage it.
The math is essentially the same as in the previous post about wrapping Christmas lights around a tree trunk.
If you have a coiled spring of radius r, the points along the coil can be described by
(r cos t, r sin t, ht/2π)
where h is the spacing between turns. If t runs from 0 to T, the length of the spring is hT/2π and the length of the material in the spring, if it were uncoiled, would be
(r² + h²/4π²)1/2 T.
When we stretch a ..read more

John D. Cook Consulting Blog

6d ago

In 2018, three researchers from the US Census Bureau published a paper entitled “Understanding Database Reconstruction Attacks on Public Data.” [1] The article showed that private data on many individuals could be reverse engineered from public data.
As I wrote about a few days ago, census blocks are at the bottom of the US Census Bureau’s hierarchy of geographical entities. On average a census block may contain about 40 people, but a block may contain only one person.
In hindsight it seems fairly obvious that data reported at the census block level is vulnerable to re-identification, and yet ..read more

John D. Cook Consulting Blog

1w ago

This post is a sort of footnote to the previous post, Estimating the number of groups of a given order.
The following is taken from an answer to a question on Stack Exchange.
In general there is no formula f(n) for the number of groups of order up to isomorphism. However, if n is squarefree (no prime to the power 2 divides n), then Otto Hölder in 1893 proved the following amazing formula
where p is a prime divisor of n/m and c(p) is the number of prime divisors q of m that satisfy q = 1 (mod p).
In a sense that can be made precise, about 60% of integers are square f ..read more

John D. Cook Consulting Blog

1w ago

John Conway et al [1] give the name gnu(n) to the number of groups of order n, where “gnu” stands for group number. This function has been studied since the 19th century, but I don’t know whether there has ever been a standard notation for it. Mathematica calls it FiniteGroupCount. It’s also the first sequence in OEIS.
When n is square-free, there is a formula due to Hölder that computes gnu(n). This formula is given in the next post. But in general computing gnu(n) is hard. However, [1] gives a surprisingly good heuristic for estimating gnu(n).
Let Ω(n) be the number of prime factors of n, co ..read more

John D. Cook Consulting Blog

1w ago

The term “nonlinear pendulum” is analogous to a retronym, a new name for an old thing to distinguish it from a new variation. For example, once upon a time a guitar was just a guitar. Now such a guitar is called an acoustic guitar to distinguish it from an electric guitar. Similarly, analog signal processing is a retronym to distinguish what was once the only kind of signal processing from the new arrival, digital signal processing.
The equation of motion for a pendulum is nonlinear. If the initial angle of displacement is sufficiently small, the linearized form of the equation is adequate for ..read more

John D. Cook Consulting Blog

1w ago

A Kepler triangle is a right triangle whose sides are in geometric progression. That is, if the sides have length a < b < c, then b/a = c/b = k.
All Kepler triangles are similar because the proportionality constant k can only take on one value. To see this, we first pick our units so that a = 1. Then b = k and c = k². By the Pythagorean theorem
a² + b² = c²
and so
1 + k2 = k4
which means k² equals the golden ratio φ.
Here’s a nice geometric property of the Kepler triangle proved in [1].
Go around the triangle counterclockwise placing a point on each side dividing the side into pieces tha ..read more

John D. Cook Consulting Blog

1w ago

Terence Tao has been experimenting with formal theorem proving using Lean and writing about his experience.
Here’s something Tao said on Mathstodon that I thought was interesting.
It is remarkable how much “decoupling” is achieved by the Lean+Blueprint combo. Contributors can work locally on proving a lemma, without necessarily fully understanding the global proof structure. Mathematicians who do understand the global proof can work on the blueprint, without necessarily understanding the mechanics of Lean. Lean experts can work on technical aspects of the implementation, such as optimizing th ..read more