Additional data does not always decrease the size of a confidence interval. From a Bayesian perspective, new information generally reduces uncertainty and makes the posterior distribution more concentrated, but the effect on posterior variance can depend on the specific circumstances.
johndcook-com
30 items from johndcook-com
The rational approximation 2721/1001 for e is notable because it achieves seven to eight significant figures of accuracy, which is far more precise than the trivial truncation 2718/1000 given its denominator size.
A blog post explores reproducing a geometry theorem diagram where segment AB is a diameter, line CD is perpendicular to the diameter, and the outer circle is a unit circle. The author found reconstructing the diagram more interesting than the theorem itself, using coordinates like C = (cos(1), sin(1)) as a starting point.
The article connects Delannoy numbers—which count the ways a king can move across a chessboard—to DNA sequence alignment problems, showing how combinatorial mathematics applies to bioinformatics.
The blog post addresses the common confusion between variables and parameters in mathematics. It highlights how teachers often define a parameter as a "constant that can vary," leading students to question the distinction. The author notes this is a frequently recurring source of confusion in mathematical instruction.
The article explains the mathematical properties of silver rectangles, which are similar to golden rectangles but based on a different ratio. Whereas a golden rectangle can be subdivided into a square and a smaller golden rectangle, a silver rectangle can be divided into two similar silver rectangles of different sizes.
The article presents a mathematical puzzle: finding a function f such that its derivative equals its inverse for all positive x. It describes this as an unusual differential equation that cannot be solved using standard techniques taught in typical differential equations classes.
The blog post compares Unix documentation for the `bc` calculator with Grok's answer about which math functions it supports. While the POSIX docs say `bc` includes Bessel functions but no tangent, Grok incorrectly claimed the opposite. The author highlights the need to verify AI-generated answers against official documentation.
The article demonstrates a Bash brace expansion one-liner that generates 30 English words (such as "when," "where," "then," "there," "hence," "henceforth," etc.) from a single nested brace pattern. The post then explains how the brace expansion tree works to produce those words.
The article revisits the topic of the period length of repeating decimals in fractions a/b, following a previous post on harmonic numbers. It explains how to determine the cycle length of decimal digits and provides code to compute it.
A follow-up post examines the number of bits in the numerator and denominator of harmonic numbers written as reduced fractions, building on previous asymptotic estimates with base-2 plots.
The nth harmonic number is the sum of reciprocals of the first n positive integers. It can be written as a fraction with numerator n! times Hn and denominator n!. This representation is mathematically correct but may not be in lowest terms.
Hart's theorem states that if a triangle is formed by the arcs of three circles, the inscribed circle and the three escribed circles are all tangent to a new circle or line.
The post explores a geometric property of Pythagorean triangles: the radius of the incircle and the radii of the excircles are all integers. It connects this observation to earlier discussions on the Star Trek lemma and Pythagorean triples, highlighting the relationship between these geometric elements in right triangles with integer sides.
The blog post explores Pythagorean triples where two of the three side lengths are consecutive integers. It examines two cases: when the legs (a and b) are consecutive, and when a leg and the hypotenuse (b and c) are consecutive, discussing the mathematical conditions and solutions for each.
John D. Cook shares a personal anecdote about discovering that Arthur Baragar's book contains a "The Star Trek Lemma," a surprising entry he found after being reminded of Baragar as his former officemate at UT.
The article discusses how regular expression implementations vary across tools, with different feature sets and syntax. The author, having learned regex in Perl's maximalist environment, notes the frustration when features expected do not work elsewhere. The post likely covers strategies for writing portable regex patterns.
Lobachevsky's integral formula states that for an even function f with period π, a certain integral relationship holds. The theorem is useful in Fourier analysis and signal processing, and can be applied even in the special case where f(x) = 1.
The article explains that for the n queens problem on an n × n board, when n is a prime number ≥ 5, a valid solution can be found by placing queens on a line with slope 2, 3, 4, and so on.
The author describes using Claude (an LLM) to generate Z3/Python code that solves a chess puzzle: placing all pieces (king, queen, two rooks, two bishops, two knights) on a 6x5 board. This follows previous posts where Claude and ChatGPT were used to generate Prolog code for similar chess problems.
John D. Cook tested Claude's ability to generate Lean 4 code for formalizing mathematical proofs, including a successful attempt at proving a ring theorem after a previous failed attempt with the pqr theorem for seminorms.
Partial fraction decomposition is commonly introduced in calculus as a technique for integrating rational functions by breaking P(x)/Q(x) into simpler terms. However, the post suggests that this method has applications beyond integration that are often overlooked in a typical calculus class.
A blog post discusses a mathematical identity where pentagonal numbers can be expressed in terms of triangular numbers. It highlights that while examples don't typically prove theorems, in this case the identity Pn = T(2n−1) − T(n−1) holds, showing that three examples can suffice for proving certain relationships.
The Schwartz-Zippel lemma shows that if two polynomials of degree at most d over a finite field agree at a few random points, it is highly likely they are identical. This probabilistic method can efficiently test polynomial identities by evaluating them at randomly chosen points. The post explains the lemma's mechanics and its practical applications.
The article discusses how the function (1 + cos(x))/2 can approximate the Gaussian density exp(−x²). Raising it to the power of 4 provides a good lower bound, while an exponent of about 3.5597 yields a good upper bound.
John D. Cook describes the evolution of email subscription methods for his blog since 2008. After using various services that came and went, he has been using Substack for the past two years to send email notifications of new posts.
A discussion on X about the approximation exp(−x²) ≈ (1 + cos(sin(x) + x))/2 suggests it can be explained by Taylor series, as the two series first differ at the x⁶ term. John D. Cook argues that this explanation is insufficient.
Summing the power series for the exponential function naively by stopping when the next term's magnitude drops below a tolerance can lead to significant errors for alternating series. The post illustrates how this approach may give inaccurate results due to cancellation between large terms, and suggests better stopping criteria or alternative summation methods.
The article discusses a cosine approximation to the Gaussian function exp(-z²), noting that while the two expressions are close along the real axis, they diverge significantly along the imaginary axis, where the approximation grows much faster (like exp(exp(y))).
The post examines the smooth, 2π-periodic function f(x) = cos(sin(x) + x) and explains that because of its properties, the trapezoid rule computes its integral very efficiently, with exponentially small error.