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-04-18 18:17
Homework problems are rigged
This post is a follow-on to a discussion that started on Twitter yesterday. This tweet must have resonated with a lot of people because it's had over 250,000 views so far. You almost have to study advanced math to solve basic math problems. Sometimes a high school student can solve a real world problem that [...]The post Homework problems are rigged first appeared on John D. Cook.
Python code for means
The last couple article have looked at various kinds of mean. The Python code for four of these means is trivial: gm = lambda a, b: (a*b)**0.5 am = lambda a, b: (a + b)/2 hm = lambda a, b: 2*a*b/(a+b) chm = lambda a, b: (a**2 + b**2)/(a + b) But the arithmetic-geometric mean [...]The post Python code for means first appeared on John D. Cook.
More ways of splitting the octave
in an earlier post I said that the arithmetic mean of two frequencies an octave apart is an interval of a perfect fifth, and the geometric mean gives a tritone. This post will look at a few other means. Intervals The harmonic mean (HM) gives a perfect fourth. The arithmetic-geometric mean (AGM) gives a pitch [...]The post More ways of splitting the octave first appeared on John D. Cook.
Maclaurin’s inequality
This afternoon I wrote a brief post about Terence Tao's new paper A Maclaurin type inequality. That paper builds on two classical inequalities: Newton's inequality and Maclaurin's inequality. The previous post expanded a bit on Newton's inequality. This post will do the same for Maclaurin's inequality. As before, let x be a list of real [...]The post Maclaurin's inequality first appeared on John D. Cook.
Newton’s inequality and log concave sequences
The previous post mentioned Newton's inequality. This post will explore this inequality. Let x be a list of real numbers and define Sn(x) to be the average over all products of n elements from x. Newton's inequality says that Sn-1 Sn+1 S^2n In more terminology more recent than Newton, we say that the sequence [...]The post Newton's inequality and log concave sequences first appeared on John D. Cook.
U statistics and a new paper by Terence Tao
Terence Tao has a new paper out that relates to a couple things I've written about recently. Elementary symmetric polynomials came up when developing the general equations for tangent sum andhyperbolic tangent sum. The latter post goes into more detail. Before that, means of symmetric functions, not necessarily elementary polynomials or even polynomials, came up [...]The post U statistics and a new paper by Terence Tao first appeared on John D. Cook.
Detecting fraud with the GRIM test
The latest episode of Erik Seligman's podcast is entitled The Grim State of Modern Pizza. Although you might not realize it from the title, the post is about fraud detection. GRIM stands for Granularity-Related Inconsistency of Means. In a nutshell, the test looks for means (averages) that are not possible on number theoretic grounds. If [...]The post Detecting fraud with the GRIM test first appeared on John D. Cook.
Tritone
A few weeks ago I wrote about how the dissonance of a musical interval is related to the complexity of the frequency ratio as a fraction, where complexity is measured by the sum of the numerator and denominator. Consonant intervals have simple frequency ratios and dissonant intervals have complex frequency ratios. By this measure, the [...]The post Tritone first appeared on John D. Cook.
When a function cannot be extended
The relation between a function and its power series is subtle. In a calculus class you'll see equations of the form series = function" which may need some footnotes. Maybe the series only represents the function over part of its domain: the function extends further than the power series representation. Starting with the power series, [...]The post When a function cannot be extended first appeared on John D. Cook.
Tanh and elementary symmetric polynomials
Yesterday I wrote a post that looked at the hyperbolic tangent sum for x and y strictly between -1 and 1. This sum arises when adding velocities in special relativity. The post ended with a description of the expression for in terms of elementary symmetric polynomials but did not offer a proof. This post will [...]The post Tanh and elementary symmetric polynomials first appeared on John D. Cook.
Addition theorems
Earlier this week I wrote about several ways to generalize trig functions. Since trig functions have addition theorems like a natural question is whether generalized trig functions also have addition theorems. Hyperbolic functions have well-known addition theorems analogous to the addition theorems above. This isn't too surprising since circular and hyperbolic functions are fundamentally two [...]The post Addition theorems first appeared on John D. Cook.
Hyperbolic tangent sum
In the previous post I said I was trying remember where I'd seen the tangent sum applied. I mentioned a couple near misses, and it turns out that what I was trying to remember was another near miss. What I'd seen before was not the tangent sum but the hyperbolic tangent sum. Several people suggested [...]The post Hyperbolic tangent sum first appeared on John D. Cook.
Tangent sum
When I was writing my post on lemniscate functions yesterday, a line from the Wikipedia article seemed familiar for reasons I cannot place. Defining a tangent-sum operator as a b := tan(arctan a + arctan b) gives cl^2z sl^2 z = 1. I feel like I've seen this tangent-sum used before, but [...]The post Tangent sum first appeared on John D. Cook.
Enriched categories
We begin with a couple examples. First, the set of linear transformations from one vector space to another is itself a vector space. Second, the set of continuous linear operators from one Banach space to another is itself a Banach space. Or maybe better, this set can be made into a Banach space. In the [...]The post Enriched categories first appeared on John D. Cook.
p-norm trig functions and “squigonometry”
This is the fourth post in a series on generalizations of sine and cosine. The first post looked at defining sine as the inverse of the inverse sine. The reason for this unusual approach is that the inverse sine is given in terms of an arc length and an integral. We can generalize sine by [...]The post p-norm trig functions and squigonometry" first appeared on John D. Cook.
Geometric derivation of hyperbolic trig functions
This is the third post in a series on generalizing sine and cosine. The previous post looked at a generalization of the sine and cosine functions that come from replacing a circle with a lemniscate, a curve that looks like a figure eight. This post looks at replacing the circle with a hyperbola. On the [...]The post Geometric derivation of hyperbolic trig functions first appeared on John D. Cook.
Lemniscate functions
In the previous post I said that you could define the inverse sine as the function that gives the arc length along a circle, then define sine to be the inverse of the inverse sine. The purpose of such a backward definition is that it generalizes to other curves besides the circle. For example, it [...]The post Lemniscate functions first appeared on John D. Cook.
Generalized trigonometry
In a recent post I mentioned in passing that trigonometry can be generalized from functions associated with a circle to functions associated with other curves. This post will go into that a little further. The equation of the unit circle is and so in the first quadrant The length of an arc from (1, 0) [...]The post Generalized trigonometry first appeared on John D. Cook.
From graph theory to category theory
Let G be a directed graph whose nodes are the positive integers and whose edges represent relations between two integers. In our first example we'll draw an edge from x to y if x is a multiple of y. In our second example we'll draw an edge from x to y if x >= y. [...]The post From graph theory to category theory first appeared on John D. Cook.
Test functions
Test functions are how you can make sense of functions that aren't really functions. The canonical example is the Dirac delta function" that is infinite at the origin, zero everywhere else, and integrates to 1. That description is contradictory: a function that is 0 almost everywhere integrates to 0, even if you work in extended [...]The post Test functions first appeared on John D. Cook.
Groups vs Abelian groups: Pedantic or profound?
This article will probably only be of interest to a small number of readers. Those unfamiliar with category theory may find it bewildering, and those well versed in category theory may find it trivial. My hope is that someone in between, someone just starting to get a handle on category theory, will find it helpful. [...]The post Groups vs Abelian groups: Pedantic or profound? first appeared on John D. Cook.
Supereggs, squigonometry, and squircles
The Depths of Wikipedia twitter account posted a screenshot about supereggs that's popular at the moment. It says there's no way this is real. they must be making these words up above a screenshot from the Wikipedia article on supereggs saying The definition can be changed to have an equality rather than an inequality; this [...]The post Supereggs, squigonometry, and squircles first appeared on John D. Cook.
Corny AI
Meredith Whittaker posted on Twitter that In addition to being the best in privacy, Signal is also the best in not subjecting you to corny AI' features no one asked for or wants. I love the phrase corny AI." That's exactly what a lot of AI features are. Would you like help composing that tweet?" [...]The post Corny AI first appeared on John D. Cook.
Today’s star
The star-like image above is today's exponential sum. The exponential sum page on my site generates a new image each day by putting the numbers of the day's month, day, and year into the equation and connecting the partial sums in the complex plane. Here m is the month, d is the day, and y [...]The post Today's star first appeared on John D. Cook.
Consecutive coupon collector problem
Coupon collector problem Suppose you have a bag of balls labeled 1 through 1,000. You draw draw balls one at a time and put them back after each draw. How many draws would you have to make before you've seen every ball at least once? This is the coupon collector problem with N = 1000, [...]The post Consecutive coupon collector problem first appeared on John D. Cook.
Regular solids and Monte Carlo integration
Monte Carlo integration is not as simple in practice as it is often introduced. A homework problem might as you to integrate a function of two variables by selecting random points from a cube and counting how many of the points fall below the graph of the function. This would indeed give you an estimate [...]The post Regular solids and Monte Carlo integration first appeared on John D. Cook.
Cross-platform way to enter Unicode characters
The previous post describes the hoops I jumped through to enter Unicode characters on a Mac. Here's a script to run from the command line that will copy Unicode characters to the system clipboard. It runs anywhere the Python module pyperclip runs. #!/usr/bin/env python3 import sys import pyperclip cp = sys.argv[1] ch = eval(f"chr(0x{cp})") print(ch) [...]The post Cross-platform way to enter Unicode characters first appeared on John D. Cook.
Using Unicode on MacOS
Setting up Unicode on my MacBook took some research, so I'm leaving myself a note here if I need to do it again. Maybe it'll help someone else too. Update: I've gotten some feedback on this article that suggest people imagine that I want to use this approach to enter large quantities of text, such [...]The post Using Unicode on MacOS first appeared on John D. Cook.
Circular coordinate art
About three years ago I ran across a strange coordinate system in which familiar functions lead to interesting plots. The system is called circular coordinates" but it is not polar coordinates. This morning I was playing around with this again. Here's a plot of f(x) = x. And here's a plot of f(x) = cos(8x). [...]The post Circular coordinate art first appeared on John D. Cook.
When there is only one group of a given size
Today's date, US style, is 9/26/2023, and there is only one group, up to isomorphism, of size 9262023. You could verify this in Mathematica with the command FiniteGroupCount[9262023] which returns 1. For a given n, when is there only one group of size n? There are two requirements. First, n has to be the product [...]The post When there is only one group of a given size first appeared on John D. Cook.
Analogy between prime numbers and simple groups
Simple groups are the building blocks of groups similar to the way prime numbers are the building blocks of integers. This post will unpack this analogy in two ways: How do simple groups compare to prime numbers? How does the composition of simple groups compare to the composition of prime numbers? The former analogy is [...]The post Analogy between prime numbers and simple groups first appeared on John D. Cook.
Normal and non-normal subgroups
The word normal" in mathematical nomenclature does not always means usual" or customary" as it does in colloquial English. Instead, it might that something has a convenient property. That is the case for normal subgroups. We can do things with normal subgroups that we cannot do with other subgroups, such as take quotients, and so [...]The post Normal and non-normal subgroups first appeared on John D. Cook.
Mersenne primes are unsafe
In the previous post I mentioned that a particular Mersenne prime would be unsuitable for cryptography. In fact, all Mersenne primes are unsuitable for cryptography. A prime number p is called safe" if p = 2q + 1 where q is also a prime. Safe primes are called safe because p - 1 does not [...]The post Mersenne primes are unsafe first appeared on John D. Cook.
Victorian public key cryptography
Electronic computers were invented before public key cryptography. Would public key cryptography have been possible before computers? The security of RSA encryption depends on the ratio of the difficulty of factoring relative to the difficulty of multiplication. This ratio was high, maybe higher, before modern computers. Suppose the idea of RSA encryption had occurred to [...]The post Victorian public key cryptography first appeared on John D. Cook.
Navigating a LaTeX file
I like generating long LaTeX documents from org-mode because, for one thing, org-mode has nice section folding. But not everyone I work with uses Emacs, so its better to work in LaTeX directly rather than have Emacs generate LaTeX. AUCTeX has section folding for LaTeX documents, though so far I've only has limited success at [...]The post Navigating a LaTeX file first appeared on John D. Cook.
HTML entity data
It's surprisingly hard to find a complete list of HTML entities in the form of a data file. There are numerous sites that give lists, often incomplete, in a page formatted to be human-readable but not machine-readable. Here's an XML file from the W3C. Here's a two-column text file I created from the W3C data.The post HTML entity data first appeared on John D. Cook.
Double-struck capital letters
I've needed to use double-struck capital letters lately, also called blackboard bold. There are a few quirks in how they are represented in Unicode and in HTML entities, so I'm leaving some notes for myself here and for anyone else who might need to look this up. Unicode The double-struck capital letters are split into [...]The post Double-struck capital letters first appeared on John D. Cook.
Primes, weeds, and military precision
Here's a quote from Don Zagier that I found in Larry Rolen's lecture notes on modular forms. There are two facts about the distribution of prime numbers of which I hope to convince you so overwhelmingly that they will be permanently engraved in your hearts. The first is that, despite their simple definition and role [...]The post Primes, weeds, and military precision first appeared on John D. Cook.
Continued fractions as matrix products
A continued fraction of the form with n terms can be written as the composition where As discussed in the previous post, a Mobius transformation can be associated with a matrix. And the composition of Mobius transformations is associated with the product of corresponding matrices. So the continued fraction at the top of the post [...]The post Continued fractions as matrix products first appeared on John D. Cook.
Fractional linear and linear
A function of the form where ad - bc 0 is sometimes called a fractional linear transformation or a bilinear transformation. I usually use the name Mobius transformation. In what sense are Mobius transformations linear transformations? They're nonlinear functions unless b = c = 0. And yet they're analogous to linear transformations. For starters, [...]The post Fractional linear and linear first appeared on John D. Cook.
Naming Awk
The Awk programming language was named after the initials of its creators. In the preface to a book that just came out, The AWK Programing Language, Second Edition, the authors give a little background on this. Naming a language after its creators shows a certain paucity of imagination. In our defense, we didn't have a [...]The post Naming Awk first appeared on John D. Cook.
Geometric mean on unit circle
Warm up The geometric mean of two numbers is the square root of their product. For example, the geometric mean of 9 and 25 is 15. More generally, the geometric mean of a set of n numbers is the nth root of their product. Alternatively, the geometric mean of a set of n numbers the [...]The post Geometric mean on unit circle first appeared on John D. Cook.
Gauss map, Euclidean algorithm, and continued fractions
The Gauss map [1] is the function where y is the floor of y, the greatest integer no larger than y. I've written about this map a couple times before. First, I wrote about how this map is measure-preserving. Second, I wrote about the image at the top of the post, based on Michael Trott's [...]The post Gauss map, Euclidean algorithm, and continued fractions first appeared on John D. Cook.
An elliptic curve is a functor
The goal of this post is to unpack a remark in [1]: ... we can say this in fancier terms. Fix a field k .... We say that an elliptic curve E defined over k is that functor which ... Well that is fancy. But what does it mean? Looking for objects A functor is [...]The post An elliptic curve is a functor first appeared on John D. Cook.
Elliptic curve addition formulas
The geometric description of addition of points P and Q on an elliptic curve involves four logical branches: If one of P or Q is the point at infinity ... Else if P = Q ... Else if P and Q lie on a vertical line ... Else ... It would seem that an algorithm [...]The post Elliptic curve addition formulas first appeared on John D. Cook.
Rational height functions
Mathematicians often speak informally about the relative simplicity of rational numbers. For example, musical intervals that correspond to simple fractions have less tension than intervals that correspond to more complicated fractions. Such informal statements can be made more precise using height functions. There are a variety of height functions designed for different applications, but the [...]The post Rational height functions first appeared on John D. Cook.
Timing attacks
If you ask someone a question and they say yes" immediately, that gives you different information than if they pause and slowly say yes." The information you receive is not just the response but also the time it took to generate the response. Encryption can be analogous. The time it takes to encrypt data can [...]The post Timing attacks first appeared on John D. Cook.
Elliptic curve Diffie-Hellman key exchange
I concluded the previous post by saying elliptic curve Diffie-Hellman key exchange (ECDHE) requires smaller keys than finite field Diffie-Hellman (FFDHE) to obtain the same level of security. How much smaller are we talking about? According to NIST recommendations, a 256-bit elliptic curve curve provides about the same security as working over a 3072-bit finite [...]The post Elliptic curve Diffie-Hellman key exchange first appeared on John D. Cook.
Finite field Diffie Hellman primes
Diffie-Hellman key exchange is conceptually simple. Alice and Bob want to generate a shared cryptographic key. They want to use asymmetric (public) cryptography to share a symmetric (private) key. The starting point is a large prime p and a generator 1 < g < p. Alice generates a large random number x, her private key, [...]The post Finite field Diffie Hellman primes first appeared on John D. Cook.
Chinese Remainder Theorem synthesis algorithm
Suppose m = pq where p and q are large, distinct primes. In the previous post we said that calculations mod m can often be carried out more efficiently by working mod p and mod q, then combining the results to get back to a result mod m. The Chinese Remainder Theorem assures us that [...]The post Chinese Remainder Theorem synthesis algorithm first appeared on John D. Cook.
...567891011121314...