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 2024-11-21 21:48
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.
Area of a triangle in the complex plane
I recently ran across an elegant equation for the area of a triangle in the complex plane with vertices at z1, z2, and z3. [1]. This formula gives the signed area: the area is positive if the points are given in countclockwise order and negative otherwise. I’ll illustrate the formula with a little Python code. […]The post Area of a triangle in the complex plane first appeared on John D. Cook.
Finding a vector potential whose curl is given
The previous post showed that if a vector field F over a simply connected domain has zero curl, then there is a potential function φ whose gradient is F. An analogous result says that if the vector field F has zero divergence, again over a simply connected domain, then there is a vector potential Φ […]The post Finding a vector potential whose curl is given first appeared on John D. Cook.
Conservative vector fields
The previous post discussed the fact that the curl of a divergence is zero. The converse is also true (given one more requirement): a vector field F is the gradient of some potential φ function if ∇×F = 0. In that case we say F is a conservative vector field. It’s clear that having zero […]The post Conservative vector fields first appeared on John D. Cook.
{div, grad, curl} of a {div, grad, curl}
The various combinations of divergence, gradient, and curl are confusing to someone seeing them for the first time, and even for someone having seen them many times. Is the divergence of a curl zero or is it the divergence of a gradient that’s zero? And there’s another one, Is it curl of curl or or […]The post {div, grad, curl} of a {div, grad, curl} first appeared on John D. Cook.
Arabic numerals and numerals that are Arabic
The characters 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 are called Arabic numerals, but there are a lot of other numerals that are Arabic. I discovered this when reading the documentation on Perl regular expressions, perlre. Here’s the excerpt from that page that caught my eye. Many scripts have their own […]The post Arabic numerals and numerals that are Arabic first appeared on John D. Cook.
Telescopes, awk, and learning
Here’s a quote I think about often: “It is faster to make a four-inch mirror and then a six-inch mirror than to make a six-inch mirror.” — Bill McKeenan, Thompson’s law of telescopes If your goal is to make a six-inch mirror, why make a four-inch mirror first? From a reductionist perspective this makes no […]The post Telescopes, awk, and learning first appeared on John D. Cook.
The messy version of Napoleon’s theorem
Napoleon’s theorem is usually presented as I presented it in the previous post. You start with a triangle (solid blue) and add equilateral triangles (dashed green) on the outside of the triangle. When you connect the centroids of these triangles you get a (dotted red) equilateral triangle. But Napoleon’s theorem is more general than this. […]The post The messy version of Napoleon’s theorem first appeared on John D. Cook.
Napoleon’s theorem
The following theorem is attributed to Napoleon Bonaparte (1769–1821). There’s some debate over whether Napoleon was the first to discover the theorem, but I don’t believe there’s any doubt that the theorem, like Morley’s theorem from the previous post, was discovered a long time after Euclid. Start with any triangle and draw equilateral triangles on […]The post Napoleon’s theorem first appeared on John D. Cook.
Trilinear coordinates
The first time I saw a reference to trilinear coordinates I thought this must be another name for barycentric coordinates. It’s not. Barycentric coordinates come up often in applications, such as when working with finite element meshes. Trilinear coordinates are less common, at least in my experience, and yet trilinear coordinates simplify a lot of classical […]The post Trilinear coordinates first appeared on John D. Cook.
Unexpected symmetry
Take an arbitrary triangle and draw the trisectors of each angle. Morley’s theorem says that the trisector lines will intersect at the vertices of an equilateral triangle. This theorem is surprising because out of a triangle with no symmetry pops a triangle with three-fold symmetry. The theorem is also historically surprising. It’s a theorem of […]The post Unexpected symmetry first appeared on John D. Cook.
Elliptic functions of a complex argument in Python
I used Mathematica to create the graphics for my previous two posts because SciPy didn’t have the functions I needed. In particular, elliptic integrals and elliptic functions in SciPy only take real-valued arguments, but I needed to use complex arguments. Also, I needed theta functions, which are not in SciPy at all. I thought mpmath […]The post Elliptic functions of a complex argument in Python first appeared on John D. Cook.
Conformal map between square and disk
Conformal maps transform one region into another while preserving angles. You might solve a PDE, for example, by mapping it to a standard region, solving it there, then mapping the solution back to the original region. Some tasks are easier to do in a square and others in a disk, so it’s clearly useful to […]The post Conformal map between square and disk first appeared on John D. Cook.
Conformal map of ellipse interior to a disk
This post will present the conformal map between the interior of an ellipse and the unit disk. Given an ellipse centered at the origin with semi-major axis a and semi-minor axis b. Will will assume without loss of generality that a² – b² = 1 and so the foci are at ±1. Hermann Schwarz published […]The post Conformal map of ellipse interior to a disk first appeared on John D. Cook.
Big correlations and big interactions
An outcome cannot be highly correlated with a large number of independent predictors. This observation has been called the piranha problem. Predictors are compared to piranha fish. If you have a lot of big piranhas in a small pond, they start eating each other. If you have a lot of strong predictors, they predict each […]The post Big correlations and big interactions first appeared on John D. Cook.
Incircle and excircles
An earlier post looked at the nine-point circle of a triangle, a circle passing through nine special points associated with a triangle. Feuerbach’s theorem that says the nine point circle of a triangle is tangent to the incircle and three excircles of the same triangle. The incircle of a triangle is the largest circle that […]The post Incircle and excircles first appeared on John D. Cook.
Double final consonants
I was listening to the latest episode of The History of English podcast and the host talked about rules for when final letters are doubled in English. One of the things he said was that if a consonant is doubled at the end of a word, it’s probably S, L, F, or Z. I tested […]The post Double final consonants first appeared on John D. Cook.
Artemis lunar orbit
I haven’t been able to find technical details of the orbit of Artemis I, and some of what I’ve found has been contradictory, but here are some back-of-the-envelope calculations based on what I’ve pieced together. If someone sends me better information I can update this post. Artemis is in a highly eccentric orbit around the […]The post Artemis lunar orbit first appeared on John D. Cook.
The nine-point circle theorem
The nine-point circle theorem says that for any triangle, there is a circle passing through the following nine points: The midpoints of each side. The foot of the altitude to each side. The midpoint between each vertex and the orthocenter. The orthocenter is the place where the three altitudes intersect. In the image above, the […]The post The nine-point circle theorem first appeared on John D. Cook.
The Möbius Inverse Monoid
I’ve written about Möbius transformations many times because they’re simple functions that nevertheless have interesting properties. A Möbius transformation is a function f : ℂ → ℂ of the form f(z) = (az + b)/(cz + d) where ad – bc ≠ 0. One of the basic properties of Möbius transformations is that they form […]The post The Möbius Inverse Monoid first appeared on John D. Cook.
Locally invertible floating point functions
Is the function x ↦ x + 2 invertible? Sure, its inverse is the function x ↦ x – 2. Is the Python function def f(x): return x + 2 invertible? Not always. You might reasonably think the function def g(x): return x - 2 is the inverse of f, and it is for many […]The post Locally invertible floating point functions first appeared on John D. Cook.
Solving Laplace’s equation in the upper half plane
In the previous post, I said that solving Laplace’s equation on the unit disk was important because the unit disk is a sort of “hub” of conformal maps: there are references and algorithms for mapping regions to and from a disk conformally. The upper half plane is a sort of secondary hub. You may want […]The post Solving Laplace’s equation in the upper half plane first appeared on John D. Cook.
Solving Laplace’s equation on a disk
Why care about solving Laplace’s equation on a disk? Laplace’s equation is important in its own right—for example, it’s important in electrostatics—and understanding Laplace’s equation is a stepping stone to understanding many other PDEs. Why care specifically about a disk? An obvious reason is that you might need to solve Laplace’s equation on a disk! […]The post Solving Laplace’s equation on a disk first appeared on John D. Cook.
Posts on ellipses and elliptic integrals
I wrote a lot of posts on ellipses and related topics over the last couple months. Here’s a recap of the posts, organized into categories. Basic geometry Eccentricity, flattening, and aspect ratio Latus rectum Directrix Example of a highly elliptical orbit More advanced geometry Pascal’s theorem Intersection of two conics Determining conic sections by points […]The post Posts on ellipses and elliptic integrals first appeared on John D. Cook.
Design of experiments and design theory
Design of experiments is a branch of statistics, and design theory is a branch of combinatorics, and yet they overlap quite a bit. It’s hard to say precisely what design theory is, but it’s consider with whether objects can be arranged in certain ways, and if so how many ways this can be done. Design […]The post Design of experiments and design theory first appeared on John D. Cook.
Repunits: primes and passwords
A repunit is a number whose base 10 representation consists entirely of 1s. The number consisting of n 1s is denoted Rn. Repunit primes A repunit prime is, unsurprisingly, a repunit number which is prime. The most obvious example is R2 = 11. Until recently the repunit numbers confirmed to be prime were Rn for […]The post Repunits: primes and passwords first appeared on John D. Cook.
Recent posts on solving equations
I’ve written several blog posts about equation solving recently. This post will summarize how in hindsight they fit together. Trig equations How to solve trig equations in general, and specifically how to solve equations involving quadratic polynomials in sine and cosine. Polynomial equations This weekend I wrote about a change of variables to “depress” a […]The post Recent posts on solving equations first appeared on John D. Cook.
...9101112131415161718...