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 02:48
Zeta sum vs zeta product
The Riemann zeta function ζ(s) is given by an infinite sum and an infinite product for complex numbers s with real part greater than 1 [*]. The infinite sum is equal to the infinite product, but which would give you more accuracy: N terms of the sum or N terms of the product? We’ll take […]The post Zeta sum vs zeta product first appeared on John D. Cook.
Approximating pi with Bernoulli numbers
In a paper on arXiv Simon Plouffe gives the formula which he derives from an equation in Abramowitz and Stegun (A&S). It took a little while for me to understand what Plouffe intended. I don’t mean my remarks here to be criticism of the author but rather helpful hints for anyone else who might have […]The post Approximating pi with Bernoulli numbers first appeared on John D. Cook.
Reverse engineering options
This weekend I saw a sign in the window of a Burger King™ that made me think of an interesting problem. If you know the number of possibilities like this, how would you reverse engineer what the options that created the possibilities? In the example above, there are 211,184 = 213×33 possible answers, and so […]The post Reverse engineering options first appeared on John D. Cook.
Foreshadowing Page Rank
Douglas Hofstadter, best known as the author of Godel, Escher, Bach, wrote the foreword to Clark Kimberling’s book Triangle Centers and Central Triangles. Hofstadter begins by saying that in his study of math he “sadly managed to sidestep virtually all of geometry” and developed an interest in geometry, specifically triangle centers, much later. The ancient […]The post Foreshadowing Page Rank first appeared on John D. Cook.
Third order ordinary differential equations
Most applied differential equations are second order. This probably has something to do with the fact that Newton’s laws are second order differential equations. Higher order equations are less common in application, and when they do pop up they usually have even order, such as the 4th order beam equation. What about 3rd order equations? […]The post Third order ordinary differential equations first appeared on John D. Cook.
Proof of optimization
Suppose you hire me to solve an optimization problem for you. You want me to find the value of x that minimizes f(x). I go off and work on finding the best value of x. I report back what I found, and you might say “Thanks, That’s a good value of x. But how do […]The post Proof of optimization first appeared on John D. Cook.
Elliptic curve primality certificates
I’ve written recently about a simple kind of primality certificates, Pratt certificates. These certificates are easy to understand, and easy to verify, but they’re expensive to produce. In order to produce a Pratt certificate that n is a prime you have to factor n-1, and that can take a long time if n is large […]The post Elliptic curve primality certificates first appeared on John D. Cook.
Primes with two non-zero bits
Suppose a number n written in binary has two 1s and all the rest of its bits are zeros. If n is prime, then the 1s must be the first and last bits of n. The first bit is 1 because the first bit of every positive integer is 1. The last bit is 1 […]The post Primes with two non-zero bits first appeared on John D. Cook.
Certified sonnet primes
Last week I wrote about primailty certificates. These certificates offer a way to verify that a number is prime using less computation than was used to discover than the number was prime. This post gives a couple more examples of primality certificates using sonnet primes. As described here, These are primes of the form ababcdcdefefgg, […]The post Certified sonnet primes first appeared on John D. Cook.
Self-documenting software
The electricity went out for a few hours recently, and because the power was out, the internet was out. I was trying to do a little work on my laptop, but I couldn’t do what I intended to do because I needed a network connection to access some documentation. I keep offline documentation for just […]The post Self-documenting software first appeared on John D. Cook.
Approximating 1/Γ(x)
A few days ago a comment that a graph looked like a Maxwell-Boltzman density lead to an approximation of 1/Γ(x), possibly a useful approximation. Approximating Γ(x) is a well-known problem, and for large x the solution is to use Stirling’s approximation or a few more terms from the asymptotic series that Stirling’s approximation is a […]The post Approximating 1/Γ(x) first appeared on John D. Cook.
Euler line
The previous post discussed the circumcenter and orthocenter of a triangle. Euler proved that the centroid, circumcenter, and orthocenter all fall on a common line, now called the Euler line. The centroid is the center of mass of a triangle. If you draw lines from each vertex to the midpoint of the opposite side, the […]The post Euler line first appeared on John D. Cook.
Relating circumcenter and orthocenter
The previous post mentioned that the law of sines gives you the diameter of a circle through the vertices of a triangle. How would you find the center of this circle, the blue dot in the image above? If the angles of the triangle are α. β, and γ, then the trilinear coordinates of the […]The post Relating circumcenter and orthocenter first appeared on John D. Cook.
Computing inscribed radius and circumscribed radius
A few days ago I wrote about the law of cotangents. This law says that if we label the sides of a triangle a, b, c and label the angles opposite each side α. β, γ, then where s is the semi-parameter, i.e. and r is the radius of the incircle, the largest circle that […]The post Computing inscribed radius and circumscribed radius first appeared on John D. Cook.
Maxwell-Boltzmann and Gamma
When I shared an image from the previous post on Twitter, someone who goes by the handle Nonetheless made the astute observation that image looked like the Maxwell-Boltzmann distribution. That made me wonder what 1/Γ(x) would be like turned into a probability distribution, and whether it would be approximately like the Maxwell-Boltzmann distribution. (Here I’m […]The post Maxwell-Boltzmann and Gamma first appeared on John D. Cook.
Visualizing convergence of an infinite product
A little while ago I wrote a post looking at how the infinite product for sine converges. The plot of the error terms is both mathematically and aesthetically interesting. This post will look at similar plots for the reciprocal of the gamma function. The reciprocal of the gamma function is an entire function, i.e. is […]The post Visualizing convergence of an infinite product first appeared on John D. Cook.
Rational Trigonometry
Rational trigonometry is a very different way of looking at geometry. At its core are two key ideas. First, instead of distance, do all your calculations in terms of quadrance, which is distance squared. Second, instead of using angles to measure the separation between lines, use spread., which turns out to be the square of […]The post Rational Trigonometry first appeared on John D. Cook.
Hidden messages in music
Geoff Lindsey contacted me recently to ask whether he could use the sheet music from one of my blog posts in a video he was making on Morse code snippets hidden in music. The sheet music appears about a minute into the video. After watching the video, his previious video played, a video about words […]The post Hidden messages in music first appeared on John D. Cook.
Law of cotangents
The previous post commented that the law of tangents is much less familiar than the laws of sines and cosines. The law of cotangents is even more obscure. If you ask Google’s Ngram viewer to plot occurrences of “law of cotangents” over time, it will return “Ngrams not found: law of cotangents.” What is this […]The post Law of cotangents first appeared on John D. Cook.
Law of tangents
I would have thought that the laws of sines, cosines, and tangents were all about equally familiar, but apparently that is not the case. Here’s a graph from Google’s Ngram viewer comparing the frequencies of law of sines, law of cosines, and law of tangents. As of 2019, the number of references to the laws […]The post Law of tangents first appeared on John D. Cook.
Pratt Primality Certificates
The previous post implicitly asserted that J = 8675309 is a prime number. Suppose you wanted proof that this number is prime. You could get some evidence that J is probably prime by demonstrating that 2J-1 = 1 mod J. You could do this in Python by running the following [1]. >>> J = 8675309 […]The post Pratt Primality Certificates first appeared on John D. Cook.
Quadratic reciprocity algorithm
The quadratic reciprocity theorem addresses the question of whether a number is a square modulo a prime. For an odd prime p, the Legendre symbol is defined to be 0 if a is a multiple of p, 1 if a is a (non-zero) square mod p, and -1 otherwise. It looks like a fraction, but […]The post Quadratic reciprocity algorithm first appeared on John D. Cook.
Groups of order 2023
How many groups are there with 2023 elements? There’s obviously at least one: Z2023, the integers mod 2023. Now 2023 = 7 × 289 = 7 × 17 × 17 and so we could also look at Z7 + Z17 + Z17 where + denotes direct sum. An element of this group has the form […]The post Groups of order 2023 first appeared on John D. Cook.
Sinc approximation to Bessel function
The Bessel functions Jn for even n look something like the sinc function. How well can you approximate the former by sums of the latter? To make things concrete, we’ll approximate J2. Here’s a plot of J2. And here’s a plot of sinc(x) = sin(πx)/πx. The sinc approximation for a function f(x) is given by […]The post Sinc approximation to Bessel function first appeared on John D. Cook.
A dozen magic square posts
Chess-related A knight’s tour magic square A king’s tour magic square Language-related Alphamagic squares in English Alphamagic squares in French Alphamagic squares in Spanish Planet-related Mars Jupyter More mathematical Magic square of squares Magic square of primes Magic squares as matrices Magical permutations Greco-Latin squares and magic squaresThe post A dozen magic square posts first appeared on John D. Cook.
Airport abbreviation origins
It doesn’t take much imagination to understand why DEN is the IATA abbreviation for the Denver airport, but the abbreviation MCO for the Orlando airport is more of a head scratcher. Here is a list of the busiest airports in the US along with a brief indication of the reason behind their abbreviations. Some require […]The post Airport abbreviation origins first appeared on John D. Cook.
Visually symmetric words
I recently ran into the following comic strip online: [Update: Thanks to Bryan Cantanzaro for letting me know via the comments that the image above was created by Hannah Hillam. The version I found had had her copyright information edited out. I will replace the image above with a legitimate version shortly.] [Update 2: I’m […]The post Visually symmetric words first appeared on John D. Cook.
Pascal’s triangle mod row number
Almost all binomial coefficients are divisible by their row number. This is a theorem from [1]. What does it mean? If you iterate through Pascal’s triangle, left-to-right and top-to-bottom, noting which entries C(m, k) are divisible by m, the proportion approaches 1 in the limit. The author proves that the ratio converges to 1, but […]The post Pascal’s triangle mod row number first appeared on John D. Cook.
Chebyshev series for sine
In last week’s post on polynomial approximations for sine, I showed that the polynomial based on Chebyshev series was much better than a couple alternatives. I calculated a few terms of the Chebyshev series for sin(πx) but didn’t include the calculations in that blog post. I calculated the series coefficients numerically, but this post will […]The post Chebyshev series for sine first appeared on John D. Cook.
Solar Day vs Sidereal Day
How long does it take the earth to complete one rotation on its axis? The answer depends on your frame of reference. A solar day is the time it takes for the sun to appear at the same position in the sky. A sidereal day is the time it takes for a distant star to […]The post Solar Day vs Sidereal Day first appeared on John D. Cook.
Coding theory posts
Here are some posts I’ve written that fall under the general heading of coding theory. Although coding theory can overlap with secret codes, it’s more concerned with things like Morse code, Reed-Solomon codes, and Unicode. Radio related Frequency Shift Keying Morse code numbers and abbreviations How efficient is Morse code? Algebraic coding theory Prefix codes […]The post Coding theory posts first appeared on John D. Cook.
Top posts of 2022
These were the most popular posts on my site this year. #10: How is portable radio possible? The length of an antenna is typically 1/2 or 1/4 of the length of the radio wave it’s designed to receive. How does an AM radio not need an antenna as long as a football field? See also […]The post Top posts of 2022 first appeared on John D. Cook.
Polynomial approximations to sine
Taylor polynomials are terrific local approximations but poor global approximations. Taylor polynomials are optimal in some sense near their center, but are seldom the best choice over a large interval. This post will look at approximating sin(πx) over [-1, 1] with fifth degree polynomials. First, this plot compares the approximation error for a fifth order […]The post Polynomial approximations to sine first appeared on John D. Cook.
Euler product for sine
Euler’s product formula for sine is To visualize the convergence of the infinite product, let’s look at the error in approximating sin(πx) with the Nth partial product of the infinite product, i.e. Here’s a plot of the partial products. We knew before making the plot that the error had to go to zero as N […]The post Euler product for sine first appeared on John D. Cook.
Surprisingly not that surprising
World record marathon times have been falling in increments of roughly 30 seconds, each new record shaving roughly 30 seconds off the previous record. If someone were to set a new record, taking 20 seconds off the previous record, this would be exciting, but not suspicious. If someone were to take 5 minutes off the […]The post Surprisingly not that surprising first appeared on John D. Cook.
Sphere of infuence
Suppose a spaceship is headed from the earth to the moon. At some point we say that the ship has left the earth’s sphere of influence is now in the moon’s sphere of influence (SOI). What does that mean exactly? Wrong explanation #1 One way you’ll hear it described is that the moon’s sphere of […]The post Sphere of infuence first appeared on John D. Cook.
Lagrange’s quintic and Descartes’ rule
Do fifth degree polynomial equations come up in applications? Yes, and this post will give an example. In general the three-body problem, describing the motion of three objects interacting under gravity, does not have a closed-form solution. However, Euler and Lagrange discovered a few special cases that do have closed-form solutions. We will look at […]The post Lagrange’s quintic and Descartes’ rule first appeared on John D. Cook.
Poisson distribution tail bounds
Yesterday Terence Tao published a blog post on bounds for the Poisson probability distribution. Specifically, he wrote about Bennett’s inequalities and a refinement that he developed or at least made explicit. Tao writes This observation is not difficult and is implicitly in the literature … I was not able to find a clean version of […]The post Poisson distribution tail bounds first appeared on John D. Cook.
Mentally calculating the day of the week in 2023
Mentally calculating the day of the week will be especially easy in 2023. The five-step process discussed here reduces to three steps in 2023. One of the steps involves leap years, and 2023 is not a leap year. Another step involves calculating and adding in the “year share,” and the year share for 2023 is […]The post Mentally calculating the day of the week in 2023 first appeared on John D. Cook.
Jacobi functions with complex parameter
Jacobi functions are complex-valued functions of a complex variable z and a parameter m. Often this parameter is real, and 0 ≤ m < 1. Mathematical software libraries, like Python’s SciPy, often have this restriction. However, m could be any complex number. The previous couple of posts spoke of the fundamental rectangle for Jacobi functions. […]The post Jacobi functions with complex parameter first appeared on John D. Cook.
Conformal map from rectangles to half plane
As discussed in the previous post, the Jacobi elliptic function sn(z, m) is doubly periodic in the complex plane, with period 4K(m) in the horizontal direction and period 2K(1-m) in the vertical direction. Here K is the complete elliptic integral of the first kind. The function sn(z, m) maps the rectangle (-K(m), K(m)) × (0, K(1-m)) […]The post Conformal map from rectangles to half plane first appeared on John D. Cook.
Solve for Jacobi sn parameter to have given period(s)
Here’s a calculation that I’ve had to do a few times. I’m writing it up here for my future reference and for the benefit of anybody else who needs to do the same calculation. The Jacobi sn function is doubly periodic: it has one period as you move along the real axis and another period […]The post Solve for Jacobi sn parameter to have given period(s) first appeared on John D. Cook.
Why determinants with columns of ones?
Geometric equations often involve a determinant with a column of 1s. For example, the equation of a line through two points or a circle through three points Or a general conic section through five points Why all the determinants and why all the 1s? When you see a determinant equal to zero, you immediately think […]The post Why determinants with columns of ones? first appeared on John D. Cook.
Conformal map of rectangle to ellipse
The previous post looked at what the sine function does to circles in the complex plane. This post will look at what it does to an rectangle. The sine function takes a rectangle of the form [0, 2π] × [0, q] to an ellipse with semi major axis cosh(q) and semi minor axis sinh(q). The […]The post Conformal map of rectangle to ellipse first appeared on John D. Cook.
Sine of a circle
What does it look like when you take the sine of a circle? Not the angle of points on a circle, but the circle itself as a set of points in the complex plane? Here’s a plot for the sine of circles of radius r centered at the origin, 0 < r < π/2. Here’s […]The post Sine of a circle first appeared on John D. Cook.
Test whether three complex numbers are vertices of an equilateral triangle
Let a, b, and c be three complex numbers. These numbers form the vertices of an equilateral triangle in the complex plane if and only if This theorem can be found in [1]. If we rotate the matrix above, we multiply its sign by -1. If we then swap two rows we multiply the determinant […]The post Test whether three complex numbers are vertices of an equilateral triangle first appeared on John D. Cook.
Arbitrary precision math in gawk
The idea of using awk for any math beyond basic arithmetic is kinda strange, and yet it has some nice features. Awk was designed for file munging, a task it does well with compact syntax. GNU awk (gawk) supports the original minimalist version of awk and adds more features. It supports arbitrary precision arithmetic by […]The post Arbitrary precision math in gawk first appeared on John D. Cook.
Unicode arrows: math versus emoji
I used the character ↔︎︎ (U+2194) in a blog post recently and once again got bit by the giant pawn problem. That’s my name for when a character intended to be rendered as text is surprisingly rendered as an emoji. I saw when what I intended was I ran into the same problem a while […]The post Unicode arrows: math versus emoji first appeared on John D. Cook.
The Orange Book
I was spelunking around in Unicode and saw that there’s an emoji for orange book, U+1F4D9. As is often the case, the emoji renders differently in different contexts. The image above is from my Linux desktop and the image below is from my Macbook. I tried created an image on my Windows box but it […]The post The Orange Book first appeared on John D. Cook.
What does rotating a matrix do to its determinant?
This post will look at rotating a matrix 90° and what that does to the determinant. This post was motivated by the previous post. There I quoted a paper that had a determinant with 1s in the right column. I debated rotating the matrix so that the 1s would be along the top because that […]The post What does rotating a matrix do to its determinant? first appeared on John D. Cook.
...10111213141516171819...