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
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.
Marden’s amazing theorem
The previous post was a warmup for this post. It gave an example of the theorem that if p is a polynomial, the roots of p′ lie inside the convex hull of the roots of p. If p is a cubic polynomial, we can say much more. Suppose p(z) is a polynomial with three distinct […]The post Marden’s amazing theorem first appeared on John D. Cook.
Convex hull of zeros
There’s a well-known theorem in complex analysis that says that if p is a polynomial, then the zeros of its derivative p′ lie inside the convex hull of the zeros of p. The convex hull of a set of points is the smallest convex set containing those points. This post gives a brief illustration of […]The post Convex hull of zeros first appeared on John D. Cook.
Escaping the unit disk
Hypergeometric functions are defined in terms of their power series representation. This power series converges inside the unit circle and diverges outside. The functions extend to most [1] of the complex plane, and do so in a computationally nice way. Analytic continuation is often sort of existential: we prove that it can be done, but […]The post Escaping the unit disk first appeared on John D. Cook.
Raabe’s convergence test
The ratio test for the convergence of a series is inconclusive if the ratio of consecutive terms converges to 1. There are more advanced variations on the ratio test, such as Raabe’s test than may succeed when the basic ratio test fails. For example, consider the hypergeometric function F(11, 3; 21; z) with parameters taken […]The post Raabe’s convergence test first appeared on John D. Cook.
Hypergeometric equation
I’ve asserted numerous times here that hypergeometric functions come up very often in applied math, but I haven’t said why. This post will give one reason why. One way to classify functions is in terms of the differential equations they satisfy. Elementary functions satisfy simple differential equations. For example, the exponential function satisfies y′ = […]The post Hypergeometric equation first appeared on John D. Cook.
It seemed like a good idea at the time
“Things are the way they are because they got that way … one logical step at a time.” — Gerald Weinberg English spelling is notoriously difficulty. It is the result of decisions that, while often unfortunate, were not unreasonable at the time. Sometimes pronunciation simplified but spelling remained unchanged. For example, originally all the letters […]The post It seemed like a good idea at the time first appeared on John D. Cook.
Fractions in Unicode
There are Unicode characters for a few fractions, such as ½. This looks a little better than 1/2, depending on the context. Here’s the Taylor series for log(1 + x) written in pure HTML: log(1 + x) = x – ½x² + ⅓x³ – ¼x⁴ + ⅕x⁵ – ⋯ See this post for how the […]The post Fractions in Unicode first appeared on John D. Cook.
Number sets in HTML and Unicode
When I started blogging I was very cautious about what characters I used because browsers often didn’t have font support for uncommon characters. Things have changed since then and I’ve gotten less cautious. Nobody has complained, so I assume readers are seeing the characters I intend them to see. There are Unicode characters for sets […]The post Number sets in HTML and Unicode first appeared on John D. Cook.
Unicode superscripts and subscripts
There are alternatives to using <sup> and <sub> tags for superscripts and subscripts in HTML. These alternatives may look better, depending on context, and they can be used in plain (Unicode) text files where HTML markup isn’t available. Superscripts When I started blogging I would use <sup>2</sup> and <sup>3</sup> for squares and cubes. Then somewhere […]The post Unicode superscripts and subscripts first appeared on John D. Cook.
Connections
One of my favorite things in math is connecting together things that do not seem related at first. This post will elaborate on a connection between two recent posts. Gauss’s constant A couple weeks ago I wrote about Gauss’s constant and several things it was related to. We can calculate g with n iterations of […]The post Connections first appeared on John D. Cook.
Foreshadowing hypergeometric functions
I’ve said in several blog posts that multi-factorials come up often in practice, and given examples. This post will give a glimpse of why this is. Rising powers The kth rising power of a is (a)k = a (a+1) (a + 2) … (a + k – 1). So, for example, (5)3 = 5*6*7 and […]The post Foreshadowing hypergeometric functions first appeared on John D. Cook.
...19202122232425262728...