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-09-11 15:16
Recommending division
A friend and I were discussing how to analyze his data one time and at the end of the conversation he said “So, basically you’re recommending division.” And indeed I was. The conclusion was to divide one thing by another. I’ve also recommended to clients that they use an extended Kalman filter or homomorphic encryption; […]The post Recommending division first appeared on John D. Cook.
Fourier, Gauss, and Heisenberg
Several weeks ago I wrote about the Fourier uncertainty principle which gives a lower bound on the product of the variance of a function f and the variance of its Fourier transform. This post expands on the earlier post by quoting some results from a recent paper [1]. Gaussian density The earlier post said that the […]The post Fourier, Gauss, and Heisenberg first appeared on John D. Cook.
More readable lambda calculus
Lambda calculus is simple. The definitions and rules of lambda calculus would easily fit on an index card. But you can’t really “read” lambda calculus so much as you can mentally execute it. Not many people can look at more than a few characters of lambda calculus and have any idea what it represents, though […]The post More readable lambda calculus first appeared on John D. Cook.
What does RIPEMD stand for?
The RIPEMD-160 secure hash function may be best known these days for its role as part of the implementation of Bitcoin. I’ve wondered what “RIPEMD” stands for, and today I stumbled on an explanation [1]: “RIPEMD” stands for “RIPE Message Digest,” where “RIPE” stands for “RACE Integrity Primitives Evaluation” and where “RACE” stands for “Research […]The post What does RIPEMD stand for? first appeared on John D. Cook.
Time dilation in SF and GPS
I’m reading Voyage to Alpha Centauri and ran into a question about relativity. The book says in one place that their ship is moving a 56.7% of the speed of light, and in another place it says that time moves about 20% slower for them relative to folks on Earth. Are those two statements consistent? […]The post Time dilation in SF and GPS first appeared on John D. Cook.
A gentle introduction to QMC and discrepancy
The previous post looked at the sequence kn mod 1 where k = log2(3). This value of k arose out of exploring perfect fifths and octaves. We saw that the sequence above fills in the unit interval fairly well, though not exactly regularly. The first 12 elements of the sequence nearly divide the unit interval […]The post A gentle introduction to QMC and discrepancy first appeared on John D. Cook.
Perfect fifths, octaves, and an ergodic map
In music, a perfect fifth is the interval between two notes whose frequencies are in 3:2 ratio. For example, the interval from an A at 440 Hz and an E at 660 Hz is a perfect fifth. Going up by 12 perfect fifths is very nearly the same as going up 7 octaves. That is, […]The post Perfect fifths, octaves, and an ergodic map first appeared on John D. Cook.
Zareba, asterism, and dinkus
Occasionally I will use a row of three asterisks to indicate the separation between the body of a blog post and the footnotes, as I did in my previous post. *** This page quotes a typesetter who said she calls this a zareba. The OED defines a zareba as a kind of cattle pen but […]The post Zareba, asterism, and dinkus first appeared on John D. Cook.
A unique property of sine
The following trig identity looks like a mistake but is correct: sin(x + y) sin(x – y) = (sin(x) + sin(y)) (sin(x) – sin(y)) It looks as if someone fallaciously expanded sin(x + y) “=” sin(x) + sin(y) and sin(x – y) “=” sin(x) – sin(y). Although both expansions are wrong, their product is correct. […]The post A unique property of sine first appeared on John D. Cook.
Information theory and coordinates
The previous post explains how the Maidenhead location system works. The first character in a location code specifies the longitude in 20 degree increments and the second character specifies the latitude in 10 degree increments. Both are a letter from A through R that breaks the possible range down into 18 parts. (The longitude range […]The post Information theory and coordinates first appeared on John D. Cook.
Maidenhead geocode system
The Maidenhead Locator System encodes a pair of longitude and latitude coordinates in a slightly complicated but ingenious way. Amateur radio operators using this geocoding system to describe locations. The Wikipedia article on the subject describes the what of the system, but I’d like to say more about the why of the system. I’ll also […]The post Maidenhead geocode system first appeared on John D. Cook.
Plastic number feels plastic
The plastic ratio is given by The Dutch architect Dom Hans van der Laan gave the number this name in 1928. He used “plastic” as an allusion to a 3D construction of the number, analogous to the 2D construction of the golden ratio. Here’s a plastic rectangle, a rectangle whose sides have the proportions of […]The post Plastic number feels plastic first appeared on John D. Cook.
Coin distribution
What is the distribution of coins you’d expect to see in a coin jar? This post will make a guess based on the following simplifying assumptions. Change is in US currency, with coins in denominations of 1, 5, 10, and 25 cents. The change due in a transaction is uniformly distributed from 0 to 99 […]The post Coin distribution first appeared on John D. Cook.
Why exponential sums are interesting
The exponential sum page on this site draws lines between the consecutive partial sums of where m is the month, d is the day, and y is the last two digits of the year. I get mixed feedback on my exponential sum page. Some people find it even more interesting than I do and have […]The post Why exponential sums are interesting first appeared on John D. Cook.
LaTeX and Lawyers
Lawyers write Word documents and mathematicians write LaTeX documents. Of course makes collaboration awkward, but there are ways to make it better. One solution is to simply use Word. People who use LaTeX probably know how to use Word, even if they’d rather not, and asking someone else to learn LaTeX is a non-starter. So […]The post LaTeX and Lawyers first appeared on John D. Cook.
A Pattern Language
I first heard of the book A Pattern Language sometime in the 1990s. I had left academia, for the first time [1], and was working as a software developer. Although the book is about architecture, software developers were exited about the book because of its analogs to software development patterns. The “Gang of Four” book […]The post A Pattern Language first appeared on John D. Cook.
Email subscription changing
Email subscription for this web site has been provided by Google Feedburner. This service is going away in July. I don’t know yet what I will replace Feedburner with. Do any of you know of an alternative that automatically sends out email when there’s a new post? I use Mail Chip to distribute by monthly […]The post Email subscription changing first appeared on John D. Cook.
The base with the largest decibel
This post is an expansion on a comment by Nathan Hannon: My favorite definition of e is “the base whose version of the decibel is the largest”. I hadn’t seen that before. Sounds interesting. What does it mean? First attempt My first thought was that the statement meant that the function b logb(x) is largest […]The post The base with the largest decibel first appeared on John D. Cook.
Relating Rényi entropy and q-log entropy
I’ve written before about Rényi entropy Hq and most recently q-log entropy Sq, two generalizations of Shannon entropy. There are simple equations relating Rényi entropy and q-log entropy if we measure both in nats: I mentioned in the post on q-log entropy that there were two possible ways it could be defined. The equation above […]The post Relating Rényi entropy and q-log entropy first appeared on John D. Cook.
Generalizing Shannon entropy with q-logs
The most common way to quantify entropy is Shannon entropy. That’s what people usually mean when they say “entropy” without further qualifications. A while back I wrote about Renyi entropy as a generalization of Shannon entropy. This time I’ll explore a different generalization called q-log entropy, a.k.a. Tsallis entropy. The definition of Shannon entropy includes […]The post Generalizing Shannon entropy with q-logs first appeared on John D. Cook.
Stumbling on an abandoned uranium mine
Last week my family and I made a tour of the five national parks in Utah. In Canyonlands National Park, my son-in-law noticed some grates at the bottom of a hill just a few feet off the road we were walking on. The area was not restricted. We walked over to investigate and found that […]The post Stumbling on an abandoned uranium mine first appeared on John D. Cook.
Decibel to log in new base
Logarithms in all bases are proportional. Specifically loga(x) = logb(x) / logb(a) for any bases a and b. One way to read this is to say that if you already know about logarithms base b, logarithms base a aren’t anything fundamentally new [1]. They’re proportional to logarithms base b, and in fact the proportionality constant […]The post Decibel to log in new base first appeared on John D. Cook.
Most popular posts this year
Here are the five most popular posts so far this year. Self-reproducing cellular automata Simple trig approximations How to mentally calculate logs Trig functions across programming languages Gell-Mann amnesia The posts above had the most page views. But just counting page views doesn’t measure what regular readers necessarily most enjoy reading. It’s heavily influenced by […]The post Most popular posts this year first appeared on John D. Cook.
Cyclic permutations and trace
The trace of a square matrix is the sum of the elements on its main diagonal. The order in which you multiply matrices matters: in general, matrix multiplication is not commutative. But the trace of a product of matrices may or may not depend on the order of multiplication. Specifically, trace doesn’t change if you […]The post Cyclic permutations and trace first appeared on John D. Cook.
Trick for 2×2 eigenvalues
3Blue1Brown has a nice new video on how to calculate the eigenvalues of 2×2 matrices. The most common way to find the eigenvalues of a 2×2 matrix A is working straight from the definition, solving det(A – λI) = 0. This is fine when you’re learning what eigenvalues are. But if you’ve already learned all […]The post Trick for 2×2 eigenvalues first appeared on John D. Cook.
Universal confidence interval
Here’s a way to find a 95% confidence interval for any parameter θ. With probability 0.95, return the real line. With probability 0.05, return the empty set. Clearly 95% of the time this procedure will return an interval that contains θ. This example shows the difference between a confidence interval and a credible interval. A […]The post Universal confidence interval first appeared on John D. Cook.
What is a polynomial?
When you leave the comfort of the real numbers, you might be mistaken about what a polynomial is. Suppose you’re looking at polynomials over some finite field. Why would you do that? Numerous practical applications, but that’s a topic for another post. You look in some reference that’s talking about polynomials and you see things […]The post What is a polynomial? first appeared on John D. Cook.
Confidence interval widths
Suppose you do N trials of something that can succeed or fail. After your experiment you want to present a point estimate and a confidence interval. Or if you’re a Bayesian, you want to present a posterior mean and a credible interval. The numerical results hardly differ, though the two interpretations differ. If you got […]The post Confidence interval widths first appeared on John D. Cook.
Multicolor reproducing cellular automata
The previous post looked at a cellular automaton introduced by Edward Fredkin. It has only two states: a cell is on or off. At each step, each cell is set to the sum of the states of the neighboring cells mod 2. So a cell is on if it had an odd number neighbors turned […]The post Multicolor reproducing cellular automata first appeared on John D. Cook.
Self-reproducing cellular automata
Edward Fredkin is best known these days for the Fredkin gate, a universal reversible circuit. I recently found out that Fredkin was one of the pioneers in cellular automata. His student Edwin Banks describes a cellular automaton introduced by Fredkin [1]. Edward Fredkin of MIT has described the following interesting cellular space. If the states […]The post Self-reproducing cellular automata first appeared on John D. Cook.
Humming St. Christopher
The other day I woke up with a song in my head I hadn’t heard in a long time, the hymn Beneath the Cross of Jesus. The name of the tune is St. Christopher. When I thought about the tune, I realized it has some fairly sophisticated harmony. My memory of the hymns I grew […]The post Humming St. Christopher first appeared on John D. Cook.
Aliquot ratio distribution
The previous post looked at repeatedly applying the function s(n) which is the sum of the divisors of n less than n. It is an open question whether the sequence s( s( s( … s(n) … ) ) ) always converges or enters a loop. In fact, it’s an open question of whether the sequence […]The post Aliquot ratio distribution first appeared on John D. Cook.
The iterated aliquot problem
Let s(n) be the sum of the proper divisors of n, the divisors less than n itself. A number n is called excessive, deficient, or perfect depending on whether s(n) – n is positive, negative, or 0 respectively, as I wrote about a few days ago. The number s(n) is called the aliquot sum of […]The post The iterated aliquot problem first appeared on John D. Cook.
Cologarithms and Entropy
The term “cologarithm” was once commonly used but now has faded from memory. Here’s a plot of the frequency of the terms cololgarithm and colog from Google’s Ngram Viewer. The cologarithm base b is the logarithm base 1/b, or equivalently, the negative of the logarithm base b. cologb x = log1/b x = -logb x […]The post Cologarithms and Entropy first appeared on John D. Cook.
Corollary of a well-known fact
When students learn about decimals, they’re told that every fraction either has a terminating decimal expansion or a repeating decimal expansion. The previous post gives a constructive proof of the converse: given a repeating fraction (in any base) it shows how to find what rational number it corresponds to. Maybe you learned this so long […]The post Corollary of a well-known fact first appeared on John D. Cook.
Repeating decimals in any base
My previous post ended with a discussion of repeating binary decimals such as 0.00110011…two = 1/5. For this post I’ll explain how calculations like that are done, how to convert a repeating decimal in any base to a fraction. First of all, we only need to consider repeating decimals of the form 0.1b, 0.01b, 0.001b, […]The post Repeating decimals in any base first appeared on John D. Cook.
Chaotic image out of regular slices
Yesterday I wrote about the bits in powers of 3. That post had a low-resolution image, which has its advantages, but here’s a higher resolution image that also has its advantages. The image looks chaotic. I say this in the colloquial sense, not in the technical sense as in period three implies chaos. I just […]The post Chaotic image out of regular slices first appeared on John D. Cook.
Evolution of random number generators
The previous post showed that the bits of prime powers look kinda chaotic. When you plot them, they form a triangular shape because the size of the numbers is growing. The numbers are growing geometrically, so their binary representations are growing linearly. Here’s the plot for powers of 5: You can crop the triangle so […]The post Evolution of random number generators first appeared on John D. Cook.
Powers of 3 in binary
I was thumbing through A New Kind of Science [1] and one of the examples that jumped out at me was looking at the bits in the binary representation of the powers of 3. I wanted to reproduce the image myself and here’s the result. Here a white square represents a 1 and a blue […]The post Powers of 3 in binary first appeared on John D. Cook.
Factors of orders of sporadic groups
I was curious about the orders of the sporadic groups, specifically their prime factors, so I made a bar graph to show how often each factor appears. To back up a little bit, simple groups are to groups roughly what prime numbers are to integers. Finite simple groups have been fully classified, and they fall […]The post Factors of orders of sporadic groups first appeared on John D. Cook.
Excessive, deficient, and perfect numbers
I learned recently that weekly excess deaths in the US have dipped into negative territory [1], and wondered whether we should start speaking of deficient deaths by analogy with excessive and deficient numbers. The ancient Greeks defined a number n to be excessive, deficient, or perfect according to whether the sum of the number’s proper […]The post Excessive, deficient, and perfect numbers first appeared on John D. Cook.
Is fast grep faster?
The grep utility searches text files for regular expressions, but it can search for ordinary strings since these strings are a special case of regular expressions. However, if your regular expressions are in fact simply text strings, fgrep may be much faster than grep. Or so I’ve heard. I did some benchmarks to see. Strictly […]The post Is fast grep faster? first appeared on John D. Cook.
Tower of powers and convergence
This post will look at the “tower of powers” and ask what it means, when it converges, and how to compute it. Along the way I’ll tie in two recent posts, including one that should come as a surprise. First of all, the expression is right-associative. That is, it is the limit of x^(x^(x^…)) and […]The post Tower of powers and convergence first appeared on John D. Cook.
Lambert W strikes again
I was studying a statistics paper the other day in which the author said to solve t log( 1 + n/t ) = k for t as part of an algorithm. Assume 0 < k < n. Is this well posed? First of all, can this equation be solved for t? Second, if there is […]The post Lambert W strikes again first appeared on John D. Cook.
Comparing files with very long lines
Suppose you need to compare two files with very long lines. Maybe each file is one line. The diff utility will show you which lines differ. But if the files are each one line, this tells you almost nothing. It confirms that there is a difference, but it doesn’t show you where the difference is. […]The post Comparing files with very long lines first appeared on John D. Cook.
New ICD-10 diagnosis code weirdness
In October 2020 there were 619 new codes added to the list of ICD-10 diagnosis codes. Some of these make sense, such as four codes added for COVID: U07.1 COVID-19 Z11.52 Encounter for screening for COVID-19 Z20.822 Contact with and (suspected) exposure to COVID-19 Z86.16 Personal history of COVID-19 There are also 24 new codes […]The post New ICD-10 diagnosis code weirdness first appeared on John D. Cook.
Magic square of squares
Allen William Johnson [1] discovered the following magic square whose entries are all squares. The following Python code verifies that this is a magic square. import numpy as np M = np.array( [[ 30**2, 246**2, 172**2, 45**2], [ 93**2, 116**2, 66**2, 258**2], [126**2, 138**2, 237**2, 44**2], [260**2, 3**2, 54**2, 150**2] ]) def verify(M): m, n […]The post Magic square of squares first appeared on John D. Cook.
Martian gravity
There is a lot of talk about Mars right now, and understandably so. The flight of Ingenuity today was awesome. As Daniel Oberhaus pointed out on Twitter, … the atmosphere on the surface of Mars is so thin that it’s the equivalent of flying at ~100k feet on Earth. No rotorcraft, piloted or uncrewed, has […]The post Martian gravity first appeared on John D. Cook.
Hashing phone numbers
A cryptographic hash is also known as a one-way function because given an input x, one can quickly compute the hash h(x), but it is extremely time-consuming to try to recover x if you only know h(x). Even if the hashing algorithm is considered “broken,” it may take an enormous effort to break it. Google […]The post Hashing phone numbers first appeared on John D. Cook.
Duodecimal vs Hexadecimal
I ran across the word duodecimal recently, the Latin-derived term for base 12, and realized it’s been years, maybe decades, since I’d heard that term. I’ve used hexadecimal explicitly in 30 different blog posts, and implicitly in more, but this is the first time I’ve used duodecimal. Hexadecimal comes up constantly in application. I suppose […]The post Duodecimal vs Hexadecimal first appeared on John D. Cook.
...26272829303132333435...