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-03-07 01:01
Generating functions for polynomial sequences
The previous post looked at a generating function for a specific polynomial sequence. This post will look at generating functions for polynomial sequences in general. (There’s an alternating term in the previous post that isn’t polynomial, but we’ll address that too.) The starting point for this post is a simple observation: If we let xD […]The post Generating functions for polynomial sequences first appeared on John D. Cook.
Generating noble gases
The previous post discussed what the periodic table would look like if it could be extended indefinitely and if certain patterns in the actual table continued to hold. In particular, the last element of each period would have atomic number and so we could call the Zn in the equation above noble numbers, atomic numbers […]The post Generating noble gases first appeared on John D. Cook.
Infinite periodic table
All the chemical elements discovered or created so far follow a regular pattern in how their electrons are arranged: the nth shell contains up to 2n – 1 suborbitals that each contain up to two electrons. For a given atomic number, you can determine how its electrons are distributed into shells and suborbitals using the […]The post Infinite periodic table first appeared on John D. Cook.
A footnote to year share
A couple weeks ago I wrote a post about the year share component of calculating the day of the week. To calculate the day of the week, you need to add the day of the week, a constant for the month, and the year share. Calculating year share is not that hard, but it’s the […]The post A footnote to year share first appeared on John D. Cook.
Inverse tetrahedral numbers
The previous post looked at the tetrahedral numbers: 1, 4, 10, 20, 35, … We could invert the process of creating tetrahedral numbers and ask for what n is a given number the nth tetrahedral number. So the inverse of 1 is 1, the inverse of 4 is 2, the inverse of 10 is etc. […]The post Inverse tetrahedral numbers first appeared on John D. Cook.
General tetrahedral numbers
Start with a list of ones: 1, 1, 1, 1, 1, … Taking the partial sums of this sequence gives consecutive numbers. That is, the nth number of the new series is the sum of the first n terms of the previous series. 1, 2, 3, 4, 5, … If we take partial sums again, […]The post General tetrahedral numbers first appeared on John D. Cook.
Visualizing C operator precedence
Here’s an idea for visualizing C operator precedence. You snake your way through the diagram starting from left to right. Operators at the same precedence level are on the same horizontal level. Following the arrows for changing directions, you move from left-to-right through the operators that associate left-to-right and you move right-to-left through the operators […]The post Visualizing C operator precedence first appeared on John D. Cook.
My interview in SIAM News
Just posted in SIAM News: A Conversation with Mathematical Consultant John D. Cook By Krešimir JosićThe post My interview in SIAM News first appeared on John D. Cook.
Numeric distance vs geographic distance in zip codes
If two zip codes numbers are close, are the regions they represent close? How much can you tell about how far apart two regions are by comparing their zip codes? (Zip codes are US postal codes. The name is an acronym for “Zone Improvement Plan” and was introduced in 1963.) To investigate this, I looked […]The post Numeric distance vs geographic distance in zip codes first appeared on John D. Cook.
Zip codes, geocodes, and Hilbert curves
You might think that if zip codes are close, then the regions they represent are close. Or that if zip codes are consecutive, then their regions touch. Neither of these are true. I explore how far they are from being true in the next post. But these statements could have been true [1]. It’s possible […]The post Zip codes, geocodes, and Hilbert curves first appeared on John D. Cook.
Conspicuously missing data
I was working on a report for a client this afternoon when I remembered this comic from Spiked Math. I needed to illustrate the point that revealing information about one person or group can reveal information on other people or other groups. If you give your genetic information to a company, for example, you also […]The post Conspicuously missing data first appeared on John D. Cook.
How to memorize the ASCII table
Before discussing how you could memorize an table of ASCII characters and numeric values, I should say a little about why you might do so. One reason is simply for the challenge. It’s more doable than it may sound. It’s also useful information, though it’s debatable whether it’s worth memorizing. YMMV. There was a time […]The post How to memorize the ASCII table first appeared on John D. Cook.
Harmonic e
Douglas Hofstadter discovered that the 8th harmonic number equals e. OK, not really. The following equation cannot possibly be true because the left side is rational and the right side is irrational. However, Hofstadter showed that the equation does hold if you carry all calculations out to three decimal places. 1.000 0.500 0.333 0.250 0.200 […]The post Harmonic e first appeared on John D. Cook.
Voiced and unvoiced consonants and digits
The latest episode of The History of English Podcast discusses the history of pronunciation changes in the Elizabethan period. The episode has a lot to say about the connections between voiced and unvoiced pairs of consonants, and the circumstances under which a consonant might change from voiced to unvoiced and vice versa. The major mnemonic […]The post Voiced and unvoiced consonants and digits first appeared on John D. Cook.
Year share
This post will be about psychology as much as math, looking at a number of algorithms for mentally calculating the same function. The most difficult part of mentally computing days of the week is computing ⌊5y/4⌋ % 7 where y is the last two digits of a year. This quantity is called the year share […]The post Year share first appeared on John D. Cook.
Decoding a grid square
I saw a reference last night to the grid square EL29fx and wanted to figure out where that is. There are many programs that will do this for you, but I wanted to do it by hand. I wrote about how grid squares work a year ago, but I was rusty on the details, so […]The post Decoding a grid square first appeared on John D. Cook.
Exponential of a line
Draw a line in the complex plane. What is the image of that line when you apply the exponential function? A line through w with direction z is the set of points w + tz where w and z are complex and t ranges over the real numbers. The image of this line is exp(w+ […]The post Exponential of a line first appeared on John D. Cook.
Discrete derivatives
If you’ve taken calculus, and someone asks you what the derivative of x5 is, you can say without hesitation that it’s 5x4. Now suppose they come back and say, “I’m sorry. I forgot to give you any context. Here x5 is a polynomial in the field of 343 elements.” It turns out that this additional […]The post Discrete derivatives first appeared on John D. Cook.
Chemical element abbreviation patterns
I’ve wondered occasionally about the patterns in how chemical elements are abbreviated. If you don’t know the abbreviation for an element, is there a simple algorithm that would let you narrow the range of possibilities or improve your odds at guessing? Here’s a survey of how the elements are abbreviated. Latin and German The elements […]The post Chemical element abbreviation patterns first appeared on John D. Cook.
Mental hash function
A few years ago I wrote about Manual Blum’s proposed method for mentally computing a secure hash function. He proposed using this method as a password manager, using the hash of a web site’s name as the password for the site. I first wrote about Blum’s method on the Heidelberg Laureate Forum blog, then wrote […]The post Mental hash function first appeared on John D. Cook.
Sampling with replacement until you’ve seen everything
Suppose you have a standard deck of 52 cards. You pull out a card, put it back in the deck, shuffle, and pull out another card. How long would you expect to do this until you’ve seen every card? Here’s a variation on the same problem. Suppose you’re a park ranger keeping data on tagged […]The post Sampling with replacement until you’ve seen everything first appeared on John D. Cook.
Tool recursion
“Literature about Lisp rarely resists that narcissistic pleasure of describing Lisp in Lisp.” — Christian Queinnec, Lisp in Small Pieces Applying software development tools to themselves has a dark side and a light side. There’s a danger of becoming obsessed with one’s tools and never getting around to using them. If it’s your job […]The post Tool recursion first appeared on John D. Cook.
New Twitter account: ElementFact
I started a new Twitter account this morning: @ElementFact. I’m thinking the account will post things like scientific facts about each element but also some history around how the element was discovered and named and other lore associated with the element. We’ll see how this goes. I’ve started many Twitter accounts over the years. Some […]The post New Twitter account: ElementFact first appeared on John D. Cook.
Approximating a golden spiral with circular arcs
The previous post included this image of a logarithm spiral passing through the corners of squares in a sequence of golden rectangles. The portion of the spiral in each square looks like a quarter of a circle. How well would circular arcs approximate the spiral? Very well. Here’s a plot. The circular arc inside the […]The post Approximating a golden spiral with circular arcs first appeared on John D. Cook.
Logarithmic spiral
I’ve seen an image similar to the following many times, but I don’t recall any source going into detail regarding how the spiral is constructed. This post will do just that. The previous post constructed iterated golden rectangles. We start with a golden rectangle and imagine chopping of first the blue, then the green, then […]The post Logarithmic spiral first appeared on John D. Cook.
Iterated golden rectangles in detail
I’ve seen the illustration of nesting golden rectangles many times, but I’ve never seen a presentation go into much detail. This post will go into more detail than usual, including Python code. Start with a golden rectangle in landscape mode. We’ll plot our rectangle with the lower left corner at the origin and the upper […]The post Iterated golden rectangles in detail first appeared on John D. Cook.
Mentally calculating the day of the week
In my previous post I mentioned John Conway’s Doomsday rule for calculating the day of the week for any date. This method starts off very simple, but gets more complicated when you actually use it. This post will present an alternative method that’s easier to use in practice and can be described more succinctly. Here’s […]The post Mentally calculating the day of the week first appeared on John D. Cook.
John Conway and mental exercise rituals
John Horton Conway (1937–2020) came up with an algorithm in 1973 for mentally calculating what day of the week a date falls on. His method, which he called the “Doomsday rule” starts from the observation that every year, the dates 4/4. 6/6, 8/8, 10/10, 12/12, 5/9, 9/5, 7/11, and 11/7 fall on the same day […]The post John Conway and mental exercise rituals first appeared on John D. Cook.
Quartal melody: Star Trek fanfare
Intervals of a fourth, such as the interval from C to F, are common in western music, but consecutive intervals of this size are not. Quartal harmony is based on intervals of fourths, and quartal melodies use a lot of fourths, particularly consecutive fourths. Maybe the most famous quartal melody is the opening fanfare to […]The post Quartal melody: Star Trek fanfare first appeared on John D. Cook.
Why target ads at pregnant women
I’m listening to a podcast interviewing Neil Richards, the author of Why Privacy Matters. Richards makes a couple interesting points about the infamous example of Target figuring out which women were pregnant based on their purchase history. First, pregnancy is a point at which women are open to trying new things. So if a company […]The post Why target ads at pregnant women first appeared on John D. Cook.
Curiously simple approximations
As I’ve written about here and elsewhere, the following simple approximations are fairly accurate. log10 x ≈ (x-1)/(x+1) loge x ≈ 2 (x – 1)/(x + 1) log2 x ≈ 3(x – 1)/(x + 1) It’s a little surprising that each is as accurate as it is, but it’s also surprising that the approximations for […]The post Curiously simple approximations first appeared on John D. Cook.
Calculating where projective lines intersect
A couple days ago I wrote about homogeneous coordinates projective planes. I said that the lines y = 5 and y = 6 intersect in a point “at infinity.” In projective geometry any two distinct lines intersect in exactly one point, and you can compute that intersection point the same way, whether the intersection is […]The post Calculating where projective lines intersect first appeared on John D. Cook.
Random Blaschke products and Mathematica binding
A Blaschke product is a function that is the product of Blaschke factors, functions of the form b(z; a) = |a| (a – z) / a (1 – a*z) where the complex number a lies inside the unit circle and a* is the complex conjugate of a. I wanted to plot Blaschke products with random […]The post Random Blaschke products and Mathematica binding first appeared on John D. Cook.
Projective duality
The previous post explained how to define a projective plane over a field F. Now let’s look at how we do geometry in a projective plane. Definitions We have a definition of points from the other post: a point is a triple (a, b, c) of elements of F, with not all elements equal to […]The post Projective duality first appeared on John D. Cook.
Finite projective planes
Given a field F, finite or infinite, you can construct a projective plane over F by starting with pairs of elements of F and adding “points at infinity,” one point for each direction. Motivation: Bézout’s theorem A few days ago I mentioned Bézout’s theorem as an example of a simple theorem that rests on complex […]The post Finite projective planes first appeared on John D. Cook.
Fixed points of bilinear transformations
Introduction I was puzzled the first time I saw bilinear transformations, also known as Möbius transformations. I was in a class where everything had been abstract and general, and suddenly thing got very concrete and specific. I wondered why we had changed gears, and I wondered how there could be much to say about something […]The post Fixed points of bilinear transformations first appeared on John D. Cook.
Partitioning complexity
This post looks at how to partition complexity between definitions and theorems, and why it’s useful to be able to partition things more than one way. Quadratic equations Imagine the following dialog in an algebra class. “Quadratic equations always have two roots.” “But what about (x – 5)² = 0. That just has one root, […]The post Partitioning complexity first appeared on John D. Cook.
French palindromes and Morse code
I got an email from a student in France who asked about a French counterpart to my post on Morse code palindromes, and this post is a response to that email. Palindromes A palindrome is a word that remains the same when the letters are reversed, like kayak. A Morse code palindrome is a word […]The post French palindromes and Morse code first appeared on John D. Cook.
Blaschke factors
Blaschke factors are complex functions with specified zeros inside the unit disk. Given a complex number a with |a| < 1, the Blaschke factor associated with a is the function Notice the semicolon in b(z; a). This is a convention that a few authors follow, and that I wish more would adopt. From a purely […]The post Blaschke factors first appeared on John D. Cook.
Inversion in a circle
Inversion in the unit circle is a way of turning the circle inside-out. Everything that was inside the circle goes outside the circle, and everything that was outside the circle comes in. Not only is the disk turned inside-out, the same thing happens along each ray going out from the origin. Points on that ray […]The post Inversion in a circle first appeared on John D. Cook.
How flat is a normal mixture on top?
Male and female heights both have a standard deviation of about 3 inches, with means of 70 inches and 64 inches. That’s a good first-pass model using round numbers. If you ask what the height of an average adult is, not specifying male or female, you get a mixture of two normal distributions. If we […]The post How flat is a normal mixture on top? first appeared on John D. Cook.
Hilbert transform and Fourier series
A few days ago I wrote about the Hilbert transform and gave as an example that the Hilbert transform of sine is cosine. We’ll bootstrap that example to find the Hilbert transform of any periodic function from its Fourier series. The Hilbert transform of a function f(t) is a function fH(x) defined by where the […]The post Hilbert transform and Fourier series first appeared on John D. Cook.
Logarithms yearning to be free
I got an evaluation copy of The Best Writing on Mathematics 2021 yesterday. One article jumped out as I was skimming the table of contents: A Zeroth Power Is Often a Logarithm Yearning to Be Free by Sanjoy Mahajan. Great title. There are quite a few theorems involving powers that have an exceptional case that […]The post Logarithms yearning to be free first appeared on John D. Cook.
Circular slide rule
I explained the basics of how a slide rule works in the previous post. But how does a circular slide rule work? Apparently the prop Mr. Spock is holding is an E6B aircraft slide rule. It includes a circular slide rule and more functionality. Start with an ordinary straight slide rule, with each bar labeled […]The post Circular slide rule first appeared on John D. Cook.
Why a slide rule works
Suppose you have two sticks. The length of one is log x, and the length of the other is log y. If you put the two sticks end to end, the combined length is log x + log y = log xy. That’s the basic idea behind a slide rule. The simplest slide rule consists […]The post Why a slide rule works first appeared on John D. Cook.
Hilbert transform and Mathematica
The Hilbert transform of a function f(t) is a function fH(x) defined [1] by The integral must be interpreted in the sense of the Cauchy principal value: The integrand is not absolutely integrable because of the singularity at x and so the value of the integral depends on how you handle the singularity. The Cauchy […]The post Hilbert transform and Mathematica first appeared on John D. Cook.
Visual integration
The plot below is of a meromorphic function f(z). That is, the function f(z) is analytic except possibly at poles, and the colors represent the phase angles, the values of θ if you write the function values in polar form. What is the value of the integral where C is the perimeter of the square? […]The post Visual integration first appeared on John D. Cook.
Regular expressions and successive approximation
Regular expressions can do a lot of tasks in practice that they cannot do in theory. That’s because a particular application of regular expressions comes with context and with error tolerance. For example, much has been said about how regular expressions cannot parse HTML. This is strictly true, but it says nothing about how well […]The post Regular expressions and successive approximation first appeared on John D. Cook.
Sum the zeros of an analytic function without finding them first
A couple days ago I wrote about how Vieta’s formulas let you sum the zeros of a polynomial without having to first compute the zeros. This is especially handy for high-order polynomials since there is no explicit formula for the zeros. Most functions that arise in applications are not polynomials. How could you find the […]The post Sum the zeros of an analytic function without finding them first first appeared on John D. Cook.
Bounding zeros of an analytic function
The previous post looked at the problem of finding the zeros of a cubic polynomial. Assuming we’re going to use a numerical method to calculate the zero, the hard part is knowing where to tell the numerical method to look. That post showed how to use a change of variables to guarantee that the polynomial […]The post Bounding zeros of an analytic function first appeared on John D. Cook.
...15161718192021222324...