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-06-07 03:01
Complex Conjugates versus Quaternion Conjugates
The conjugate of a complex number is the complex number Taking the conjugate flips over a complex number, taking its reflection in the real axis. Multiplication stretches and rotates complex numbers, and addition translates complex numbers. You can’t flip the complex plane over by any series of dilatations, rotations, and translations. The situation is different […]The post Complex Conjugates versus Quaternion Conjugates first appeared on John D. Cook.
The center may not hold
“… Things fall apart; the centre cannot hold …” — Yeats, The Second Coming Center of a group The center of a group is the set of elements that commute with everything else in the group. For example, matrix multiplication is not commutative in general. You can’t count on AB being equal to BA, […]The post The center may not hold first appeared on John D. Cook.
The congruent number problem
A positive integer n is said to be congruent if there exists a right triangle with area n such that the length of all three sides is rational. You could always choose one leg to have length n and the other to have length 2. Such a triangle would have area n and two rational […]The post The congruent number problem first appeared on John D. Cook.
Aesthetic uses of Latin squares
We think they like randomness in design, but we don’t exactly. People like things that are sorta random, but not too random. When you literally scatter things randomly, they looked too clumped [1]. There are many ways around this problem, variations on randomness that people find more aesthetically pleasing. One of these ways is random […]The post Aesthetic uses of Latin squares first appeared on John D. Cook.
Know the rules to break the rules
There’s a saying in the arts “Know the rules before you break the rules.” Master the classical conventions of your field before you violate them. Break the rules deliberately and not accidentally, skillfully and not due to a lack of skill. There’s a world of difference between a beginning musician playing a wrong note and […]The post Know the rules to break the rules first appeared on John D. Cook.
How many Latin squares are there?
A Latin square is an n × n grid with a number from 1 to n in each cell, such that no number appears twice in a row or twice in a column. It’s not obvious that Latin squares exist for all n, but they do, and in fact there are a lot of them. […]The post How many Latin squares are there? first appeared on John D. Cook.
Yule statistics Y and Q
I recently wrote about the Yule-Simon distribution. The same Yule, George Udny Yule, is also known for the statistics Yule’s Y and Yule’s Q. The former is also known as the coefficient of colligation, and the latter is also known as the Yule coefficient of association. Both measure how things are related. Given a 2 […]The post Yule statistics Y and Q first appeared on John D. Cook.
Deleting reproducible files in Emacs dired
Imagine you could list the contents of a directory from a command line, and then edit the text output to make things happen. That’s sorta how Emacs dired works. It’s kind of a cross between a bash shell and the Windows File Explorer. Why would you ever want to use such a bizarre hybrid? One […]The post Deleting reproducible files in Emacs dired first appeared on John D. Cook.
Fraud, Sloppiness, and Statistics
A few years ago the scientific community suddenly realized that a lot of scientific papers were wrong. I imagine a lot of people knew this all along, but suddenly it became a topic of discussion and people realized the problem was bigger than imagined. The layman’s first response was “Are you saying scientists are making […]The post Fraud, Sloppiness, and Statistics first appeared on John D. Cook.
Comparing three discrete power laws
Yesterday I wrote about the zeta distribution and the Yule-Simon distribution and said that they, along with the Zipf distribution, are all discrete power laws. This post fills in detail for that statement. The probability mass functions for the zeta, Zipf, and Yule-Simon distributions are as follows. Here the subscripts ζ, y, and z stand for […]The post Comparing three discrete power laws first appeared on John D. Cook.
The zeta distribution
The previous post on the Yule-Simon distribution mentioned the zeta distribution at the end. This is a powerlaw distribution on the positive integers with normalizing constant given by the Riemann zeta distribution. That is, the zeta distribution has density f(k; s) = k–s / ζ(s). where k is a positive integer and s > 1 is […]The post The zeta distribution first appeared on John D. Cook.
Yule-Simon distribution
The Yule-Simon distribution, named after Udny Yule and Herbert Simon, is a discrete probability with pmf The semicolon in f(k; ρ) suggests that we think of f as a function of k, with a fixed parameter ρ. The way the distribution shows the connection to the beta function, but for our purposes it will be […]The post Yule-Simon distribution first appeared on John D. Cook.
Mahalanobis distance and Henry V
I was reading a stats book that mentioned Mahalanobis distance and that made me think of Non Nobis from Henry V, a great scene in a great movie. As far as I know, there’s no connection between Mahalanobis and Non Nobis except that both end in “nobis.” Since Mahalanobis is an Indian surname and Non […]The post Mahalanobis distance and Henry V first appeared on John D. Cook.
Probability of a magical permutation
Take a permutation of the numbers 1 through n² and lay out the elements of the permutation in a square. We will call a permutation a magic permutation if the corresponding square is a magic square. What is the probability that a permutation is a magic permutation? That is, if you fill a grid randomly […]The post Probability of a magical permutation first appeared on John D. Cook.
Degree of magic
A square grid of distinct integers is a magic square if all its rows columns and full diagonals have the same sum. Otherwise it is not a magic square. Now suppose we fill a square grid with samples from a continuous random variable. The probability that the entries are distinct is 1, but the probability […]The post Degree of magic first appeared on John D. Cook.
Universal properties
I started to write a blog post about universal properties, but ended up writing a Twitter thread instead.The post Universal properties first appeared on John D. Cook.
The ring of entire functions
Rings made a bad first impression on me. I couldn’t remember the definitions of all the different kinds of rings, much less have an intuition for what was important about each one. As I recall, all the examples of rings in our course were variations on the integers, often artificial variations. Entire functions I’m more […]The post The ring of entire functions first appeared on John D. Cook.
The awkward middle child of algebra
Abstract algebra is basically the study of groups, rings, and fields. There are more concepts, but these are the big three. Groups have the least structure and fields have the most structure. Rings are somewhere in the middle. Groups have just one operation, which is thought of as multiplication by default. If the group operation […]The post The awkward middle child of algebra first appeared on John D. Cook.
Partial functions and total functions
I was thinking about writing a post about entire functions and it occurred to me that I should say something about how entire functions are unrelated to total functions. But then I realized they’re not unrelated. I intend to say something about entire functions in a future post. Update: See The ring of entire functions. […]The post Partial functions and total functions first appeared on John D. Cook.
Exact sequences
A couple days ago, near the end of a post, I mentioned exact sequences. This term does not mean what you might reasonably think it means. It doesn’t mean exact in the sense of not being approximate. It means that the stuff that comes out of one step is exactly the stuff that gets set […]The post Exact sequences first appeared on John D. Cook.
Data swamps
I recently heard the term data swamp, a humorous take on data lakes. I thought about data swamps yesterday when I hiked past the literal swamp in the photo above. Swamps are a better metaphor than lakes for heterogeneous data collections because a lake is a homogeneous body of water. What makes a swamp a […]The post Data swamps first appeared on John D. Cook.
Numerical footnote
Yesterday’s post said that that you could construct a chain of linear relationships between the hypergeometric function F(a, b; c; z) and F(a+i, b+j; c+k; z) for integers i, j, and k. Toward the end of the post I said that this could be used to speed up programs by computing function values from previous […]The post Numerical footnote first appeared on John D. Cook.
Four, five, and nine lemmas
This post is similar in spirit to the previous post: reducing mathematical theorems to moves in a board game by looking at things from a ridiculously high level. The theorems we’ll be looking at are known as the four lemma, the five lemma, and the nine lemma. The nine lemma is also known as the […]The post Four, five, and nine lemmas first appeared on John D. Cook.
3D Go with identities
Let’s play a game that’s something like Go in three dimensions. Our game is played on the lattice of points in 3D that have integer coordinates. Someone places stones on two lattice points, and your job is to create a path connecting the two stones by adding stones to neighboring locations. Game cube We don’t […]The post 3D Go with identities first appeared on John D. Cook.
Area of spherical triangle
A few days ago I wrote about how you could calculate the area of a spherical triangle by measuring the angles at its vertices. As was pointed out in the comments, there’s a much more direct way to find the area. Folke Eriksson gives the following formula for area in [1]. If a, b, and […]The post Area of spherical triangle first appeared on John D. Cook.
Triangles on a pseudosphere
The previous post was about triangles on a sphere. This post will be about triangles on a pseudosphere. A pseudosphere looks something like the bell of a trumpet or a trombone. Here’s a plot of a pseudosphere. This was created in Mathematica with the code ParametricPlot3D[ { Cos[p] Sech[t], -Sin[p] Sech[t], t - Tanh[t] }, […]The post Triangles on a pseudosphere first appeared on John D. Cook.
A tale of three cities
Pick three cities and form a spherical triangle by connecting each pair of cities with the shortest arc between them. How might you find the area of this triangle? For this post, I’ll assume the earth is perfectly spherical. (Taking into account that the earth is slightly oblate makes the problem much more complicated. Maybe […]The post A tale of three cities first appeared on John D. Cook.
Great circle through two points on a sphere
Given two points on a unit sphere, there is a unique great circle passing through the two points. This post will show two ways to find a parameterization for this circle. Both approaches have their advantages. The first derivation is shorter and in some sense simpler. The second derivation is a little more transparent and […]The post Great circle through two points on a sphere first appeared on John D. Cook.
Wire gauge and user perspective
Wire gauge is a perennial source of confusion: larger numbers denote smaller wires. The reason is that gauge numbers were assigned from the perspective of the manufacturing process. Thinner wires require more steps in production. This is a common error in user interface design and business more generally: describing things from your perspective rather than […]The post Wire gauge and user perspective first appeared on John D. Cook.
New twitter account: tensor_fact
I’ve started a new Twitter account: @tensor_fact. The word “tensor” is used to describe several different but related mathematical objects. My intention, at least for now, it to focus on tensor calculus: things with indices that obey certain transformation rules. More on other meanings of tensor here. Related From tape measures to tensors Technical Twitter […]The post New twitter account: tensor_fact first appeared on John D. Cook.
How to put a series in hypergeometric form
I skipped a step in the previous post, not showing how a series was put into the form of a hypergeometric function. Actually I skipped two steps. I first said that a series was not obviously hypergeometric, and yet at first glance it sorta is. I’d like to make up for both of these omissions, […]The post How to put a series in hypergeometric form first appeared on John D. Cook.
Quintic trinomial root
This post looks at an exercise from Special Functions, exercise 6 in Appendix E. Suppose that xm+1 + ax – b = 0. Show that Use this formula to find a solution to x5 + 4x + 2 = 0 to four decimal places of accuracy. When m = 0 this series reduces to the […]The post Quintic trinomial root first appeared on John D. Cook.
Theory, practice, and integration
Theory and practice are both important. As Donald Knuth put it, If you find that you’re spending almost all your time on theory, start turning some attention to practical things; it will improve your theories. If you find that you’re spending almost all your time on practice, start turning some attention to theoretical things; it […]The post Theory, practice, and integration first appeared on John D. Cook.
Information loss and entropy
John Baez, Tobias Fritz, and Tom Leinster wrote a nice paper [1] that shows Shannon entropy is the only measure of information loss that acts as you’d expect, assuming of course you have the right expectations. See their paper for all the heavy lifting. All I offer here is an informal rewording of the hypotheses. […]The post Information loss and entropy first appeared on John D. Cook.
Partition symmetry
Let p(M, N, n) be the number of partitions of the integer n into at most M parts, each containing integers at most N. Then p(M, N, n) = p(N, M, n). That is, you can swap the size of the partition multisets and the upper bound on the elements in the multisets. For example, […]The post Partition symmetry first appeared on John D. Cook.
Numbering the branches of the Lambert W function
The previous post used the Lambert W function to solve an equation that came up in counting partitions of an integer. The first solution found didn’t make sense in context, but another solution, one on a different branch, did. The default branch k = 0 wasn’t what we were after, but the branch k = […]The post Numbering the branches of the Lambert W function first appeared on John D. Cook.
Solving equations with Lambert’s W function
In the previous post we wanted to find a value of n such that f(n) = 1012 where and we took a rough guess n = 200. Turns out f(200) ≈ 4 × 1012 and that was good enough for our purposes. But what if we wanted to solve f(n) = x accurately? We will […]The post Solving equations with Lambert’s W function first appeared on John D. Cook.
Estimating the number of integer partitions
Last week I wrote a few posts that included code that iterated over all partitions of a positive integer n. See here, here, and here. How long would it take these programs to run for large n? For this post, I’ll focus just on how many partitions there are. It’s interesting to think about how […]The post Estimating the number of integer partitions first appeared on John D. Cook.
Vector spaces and subspaces over finite fields
A surprising amount of linear algebra doesn’t depend on the field you’re working over. You can implicitly assume you’re working over the real numbers R and prove all the basic theorems—say all the theorems that come before getting into eigenvalues in a typical course—and all or nearly all of the theorems remain valid if you swap […]The post Vector spaces and subspaces over finite fields first appeared on John D. Cook.
Mathematical plot twist: q-binomial coefficients
The simplest instance of a q-analog in math is to replace a positive integer n by a polynomial in q that converges to n as q → 1. Specifically, we associate with n the polynomial [n]q = 1 + q + q² + q³ + … + qn-1. which obviously converges to n when q → 1. […]The post Mathematical plot twist: q-binomial coefficients first appeared on John D. Cook.
Another pentagonal number theorem
An earlier post presented Euler’s pentagonal number theorem. This post presents a similar theorem by N. J. Fine developed two centuries later. Define the jth pentagonal number by Pj = j(3j – 1) / 2 where j can be any integer, e.g. j can be negative. Theme Let De(n) is the number of distinct partitions […]The post Another pentagonal number theorem first appeared on John D. Cook.
Odd parts and distinct parts
The previous post looked at a result of Euler regarding even and odd distinct partitions. This post will illustrate a related theorem by Euler. Definitions A partition of a positive integer n is a way of writing n as the sum of positive integers, without distinguishing the order of the terms, only the multi-set of […]The post Odd parts and distinct parts first appeared on John D. Cook.
Partitions and Pentagons
This post will present a remarkable theorem of Euler which makes a connection between integer partitions and pentagons. Partitions A partition of an integer n is a way of writing n as a sum of positive integers. For example, there are seven unordered partitions of 5: 5 4 + 1 3 + 2 3 + […]The post Partitions and Pentagons first appeared on John D. Cook.
Rising and falling powers
I’ve mentioned rising powers several times recently. They come up in practice fairly often. Sometimes you see falling powers as well, and there’s a simple symmetry between the two. There are multiple ways to denote rising powers, and lately I’ve used the Pochhammer notation (x)k because it’s easy to type in HTML without having to […]The post Rising and falling powers first appeared on John D. Cook.
Three kinds of confluence
We say someone is fluent in a language if their words flow easily. The word fluent comes from the Latin fluere which means to flow. We say things are confluent if they flow together, such as the confluence of two streams. This post will give three examples of the use of confluent in math and […]The post Three kinds of confluence first appeared on John D. Cook.
Three error function series
A common technique for numerically evaluating functions is to use a power series for small arguments and an asymptotic series for large arguments. This might be refined by using a third approach, such as rational approximation, in the middle. The error function erf(x) has alternating series on both ends: its power series and asymptotic series […]The post Three error function series first appeared on John D. Cook.
A more powerful alternating series theorem
In application you often truncate an infinite series to give a practical approximation. Ideally you’d like to know how accurate the approximation is. It would be even better to know the sign of the error of the approximation. Alternating series let you do this. But some forms of the alternating series theorem leave money on […]The post A more powerful alternating series theorem first appeared on John D. Cook.
Gamma distribution tail probability approximation
This post will approximate of the tail probability of a gamma random variable using the heuristic given in the previous post. The gamma distribution Start with the integral defining Γ(a). Divide the integrand by Γ(a) so that it integrates to 1. This makes the integrand into a probability density, and the resulting probability distribution is […]The post Gamma distribution tail probability approximation first appeared on John D. Cook.
The 1/e heuristic
The previous post looked at the FWHM (full width at half maximum) technique for approximating integrals, applied to the normal distribution. This post is analogous, looking at the 1/e heuristic for approximating integral. We will give an example in this post where the heuristic works well. The next post will give an example where the […]The post The 1/e heuristic first appeared on John D. Cook.
Simple normal distribution tail estimate
A very common task in probability and statistics is to estimate the probability of a normal random variable taking on a value larger than a given value x. By shifting and scaling we can assume our normal random variable has mean 0 and variance 1. This means we need to approximate the integral We are […]The post Simple normal distribution tail estimate first appeared on John D. Cook.
...20212223242526272829...