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
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.
Hidden double factorial example
A while back I wrote several about multi-factorials and gave examples of triple factorials and quadruple factorials in action. I didn’t do a post on double factorials because they are more common. But an example I ran into recently changed my mind. If you skim a table of power series you will run into a […]The post Hidden double factorial example first appeared on John D. Cook.
Euler polynomials
The previous post looked at the logistic function and showed how it illustrates Runge’s phenomenon: adding interpolation points makes the interpolation error worse. Here’s another interesting thing about the logistic function: it’s power series coefficients involve Euler polynomials. So, what are Euler polynomials? I don’t have a good answer to that, but I can say […]The post Euler polynomials first appeared on John D. Cook.
Logistic counterexamples
The function f(x) = 1/(1 + x²) is commonly used as an example to disprove a couple things students might be lead to believe. This post will show how the logistic function g(x) = exp(x)/(1 + exp(x)) could be used in the same contexts. This shows that f(x) is not an isolated example, and the […]The post Logistic counterexamples first appeared on John D. Cook.
Dirichlet series generating functions
A couple days ago I wrote about Dirichlet convolution, and in that post I said Define the function ζ to be the constant function 1. This was following the notation from the book I quoted in the post. Someone might question the use of ζ because it is commonly used to denote the Riemann ζ […]The post Dirichlet series generating functions first appeared on John D. Cook.
Unintended programming languages
As I mentioned a few days ago, I’ve been looking at Remora, a sort of child of Lisp and APL. I find it interesting that neither Lisp nor APL were initially intended to be programming languages. (I also find it interesting that Lisp and APL are at opposite ends of the syntax spectrum, from minimal […]The post Unintended programming languages first appeared on John D. Cook.
An interesting recursion
The previous post concerned finding the inverse of a function with respect to Dirichlet convolution. Given a function f defined on the positive integers, we want to find a function g, also defined on positive integers, such that f*g = δ. This means we want to find a function g such that the sum evaluates […]The post An interesting recursion first appeared on John D. Cook.
Dirichlet convolution
That can’t be right I was skimming a book on number theory [1] recently and came across the following theorem that makes no sense out of context: An arithmetical function f has an inverse if and only if f(1) ≠ 0. Wait, what?! That’s obviously false unless I’ve missed something. Maybe “arithmetical function” is far […]The post Dirichlet convolution first appeared on John D. Cook.
Nota bene
NB I was looking at the J programming language yesterday and I was amused to see that it uses “NB.” to mark the rest of a line of source code as a comment, just like # in Python or // in C++. This makes comments in J look like comments in English prose. “NB” abbreviates […]The post Nota bene first appeared on John D. Cook.
What’s “differential” about differential privacy?
Interest in differential privacy is growing rapidly. As evidence of this, here’s the result of a Google Ngram search [1] on “differential privacy.” When I first mentioned differential privacy to consulting leads a few years ago, not many had heard of it. Now most are familiar with the term, though they may not be clear […]The post What’s “differential” about differential privacy? first appeared on John D. Cook.
Everywhere chaotic map on the sphere
Let f be a complex-valued function of a complex variable. The Julia set of f is the set of points where f is chaotic. Julia sets are often complicated fractals, but they can be simple. In this post I want to look at the function f(z) = (z² + 1)² / 4z(z² – 1). I […]The post Everywhere chaotic map on the sphere first appeared on John D. Cook.
Quadruple factorials and Legendre functions
Last week I claimed that double, triple, and quadruple factorials came up in applications. The previous post showed how triple factorials come up in solutions to Airy’s equation. This post will show how quadruple factorials come up in solutions to Legendre’s equation. Legendre’s differential equation is The Legendre functions Pν and Qν are independent solutions […]The post Quadruple factorials and Legendre functions first appeared on John D. Cook.
Triple factorials and Airy functions
Last week I wrote in a post on multifactorials in which I said that Double factorials come up fairly often, and sometimes triple, quadruple, or higher multifactorials do too. This post gives a couple examples of triple factorials in practice. One example I wrote about last week. Triple factorial comes up when evaluating the gamma […]The post Triple factorials and Airy functions first appeared on John D. Cook.
Gauss’s constant
I hadn’t heard of Gauss’s constant until recently. I imagine I’d seen it before and paid no attention. But once I paid attention, I started seeing it more often. There’s a psychology term for this—reticular activation?—like when you buy a green Toyota and suddenly you see green Toyotas everywhere. Our starting point is the arithmetic-geometric […]The post Gauss’s constant first appeared on John D. Cook.
Gamma of integer plus one over integer
The gamma function satisfies Γ(x+1) = x Γ(x) and so in principle you could calculate the gamma function for any positive real number if you can calculate it on the interval (0, 1). For example, So if you’re able to compute Γ(π-3) then you could compute Γ(π). If n is a positive integer ε is some […]The post Gamma of integer plus one over integer first appeared on John D. Cook.
Multifactorial
The factorial of an integer n is the product of the positive integers up to n. The double factorial of an even (odd) integer n is the product of the positive even (odd) integers up to n. For example, 8!! = 8 × 6 × 4 × 2 and 9!! = 9 × 7 × […]The post Multifactorial first appeared on John D. Cook.
Discrete sum analog of Gaussian integral
A comment on a recent post lead me to a page of series on Wikipedia. The last series on that page caught my eye: It’s a lot more common to see exp(-πx²) inside an integral than inside a sum. If the summation symbol were replaced with an integration sign, the integral would be 1. You […]The post Discrete sum analog of Gaussian integral first appeared on John D. Cook.
The Calculus of Finite Differences
The Calculus of Finite Differences by L. M. Milne-Thompson is a classic. It covers a great deal of elegant and useful [1] mathematics that isn’t widely known, at least not any more. For a taste of the subject matter of the book, see this post. The book is now in the public domain—at least in […]The post The Calculus of Finite Differences first appeared on John D. Cook.
Multiple angle identity for cotangent
The previous post discusses generalized replicative functions, functions that satisfy Donald Knuth says in Exercise 40 of Section 1.2.4 of TAOCP that the functions cot πx and csc² πx fall into this class of functions. If this is true of cot πx then it follows by differentiation that it is true of csc² πx as […]The post Multiple angle identity for cotangent first appeared on John D. Cook.
Multiplication theorem rabbit hole
When I started blogging I was reluctant to allow comments. It seems this would open the door to a flood of spam. Indeed it does, but nearly all of it can be filtered out automatically. The comments that aren’t spam have generally been high quality. A comment on my post about the sawtooth function a […]The post Multiplication theorem rabbit hole first appeared on John D. Cook.
Gamma and the Pi function
The gamma function satisfies Γ(n+1) = n! for all non-negative integers n, and extends to an analytic function in the complex plane with the exception of singularities at the non-positive integers [1]. Incidentally, going back to the previous post, this is an example of a theorem that would have to be amended if 0! were […]The post Gamma and the Pi function first appeared on John D. Cook.
Why is it defined that way?
There are numerous conventions in mathematics that student continually question. Why isn’t 1 a prime number? Why is 0! defined to be 1? Why is an empty sum 0 and an empty product 1? Why can’t you just say 1/0 = ∞? Etc. There are good reasons for the existing conventions, and they usually boil […]The post Why is it defined that way? first appeared on John D. Cook.
Sawtooth and replicative functions
Here’s something I ran across in Volume 2 of Donald Knuth’s The Art of Computer Programming. Knuth defines the sawtooth function by ((x)) = x – (⌊x⌋ + ⌈x⌉)/2. Here’s a plot. This is an interesting way to write the sawtooth function, one that could make it easier to prove things about, such as the […]The post Sawtooth and replicative functions first appeared on John D. Cook.
Aquinas on epicycles
C. S. Lewis quotes Thomas Aquinas in The Discarded Image: In astronomy an account is given of eccentricities and epicycles on the ground that if their assumption is made the sensible appearances as regards celestial motion can be saved. But this is not a strict proof since for all we know they could also be […]The post Aquinas on epicycles first appeared on John D. Cook.
Estimating normal tail extreme probabilities
In the previous post I said the probability of a normal distribution being 50 standard deviations from its mean was absurdly small, but I didn’t quantify it. You can’t simply fire up something like R and ask for the probability. The actual value is smaller than can be represented by a floating point number, so […]The post Estimating normal tail extreme probabilities first appeared on John D. Cook.
50 sigma events for t distributions
I had a recent discussion with someone concerning a 50 sigma event, and that conversation prompted this post. When people count “sigmas” they usually have normal distributions in mind. And six-sigma events so rare for normal random variables that it’s more likely the phenomena under consideration doesn’t have a normal distribution. As I explain here, […]The post 50 sigma events for t distributions first appeared on John D. Cook.
Guide to the recent flurry of posts
I wrote six blog posts this weekend, and they’re all related. Here’s how. Friday evening I wrote a blog post about a strange random number generator based on factorials. The next day my electricity went out, and that led me to think how I would have written the factorial RNG post without electricity. That led […]The post Guide to the recent flurry of posts first appeared on John D. Cook.
Trailing zeros of factorials, revisited
I needed to know the number of trailing zeros in n! for this post, and I showed there that the number is Jonathan left a comment in a follow-up post giving a brilliantly simple approximation to the sum above: … you can do extremely well when calculating the number of trailing 0’s by dropping the […]The post Trailing zeros of factorials, revisited first appeared on John D. Cook.
Filling in gaps in a trig table
The previous post shows how you could use linear interpolation to fill in gaps in a table of logarithms. You could do the same for a table of sines and cosines, but there’s a better way. As before, we’ll assume you’re working by hand with just pencil, paper, and a handbook of tables. Linear interpolation […]The post Filling in gaps in a trig table first appeared on John D. Cook.
Tables and interpolation
The previous post about hand calculations involved finding the logarithm of a large integer using only tables. We wanted to know the log base 10 of 8675310 and all we had was a table of logarithms of integers up to 1350. We used log10 867 = 2.9380190975 log10 868 = 2.9385197252 and linear interpolation to […]The post Tables and interpolation first appeared on John D. Cook.
Calculating without electricity
A transformer in my neighborhood blew sometime in the night and my electricity was off this morning. I thought about the post I wrote last night and how I could have written it without electricity. Last night’s post included an example that if n = 8675309, n! has 56424131 digits, and that the last 2168823 […]The post Calculating without electricity first appeared on John D. Cook.
Floor exercises
The previous post explained why the number of trailing zeros in n! is and that the sum is not really infinite because all the terms with index i larger than log5 n are zero. Here ⌊x⌋ is the floor of x, the largest integer no greater than x. The post gave the example of n […]The post Floor exercises first appeared on John D. Cook.
Factorial random number generator
Here’s a strange pseudorandom number generator I ran across recently in [1]. Starting with a positive integer n, create a sequence of bits as follows. Compute n! as a base 10 number. Cut off the trailing zeros. Replace digits 0 through 4 with 0, and the rest with 1. You’d want to use a fairly […]The post Factorial random number generator first appeared on John D. Cook.
...23242526272829303132...