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 16:32
Wrapping Christmas lights around a tree trunk
Suppose you want to wrap Christmas lights around a tree trunk that we can approximate by a cylinder of radius r. You want to wrap lights around the tree in a helix, going up a distance h every time you go around the tree once. What length of lights do you need to make n [...]The post Wrapping Christmas lights around a tree trunk first appeared on John D. Cook.
Database reconstruction attacks
In 2018, three researchers from the US Census Bureau published a paper entitled Understanding Database Reconstruction Attacks on Public Data." [1] The article showed that private data on many individuals could be reverse engineered from public data. As I wrote about a few days ago, census blocks are at the bottom of the US Census [...]The post Database reconstruction attacks first appeared on John D. Cook.
Number of groups of squarefree order
This post is a sort of footnote to the previous post, Estimating the number of groups of a given order. The following is taken from an answer to a question on Stack Exchange. In general there is no formulaf(n) for the number of groups of order up to isomorphism. However, if n is squarefree (no [...]The post Number of groups of squarefree order first appeared on John D. Cook.
Estimating number of groups of a given order
John Conway et al [1] give the name gnu(n) to the number of groups of order n, where gnu" stands for group number. This function has been studied since the 19th century, but I don't know whether there has ever been a standard notation for it. Mathematica calls it FiniteGroupCount. It's also the first sequence [...]The post Estimating number of groups of a given order first appeared on John D. Cook.
Period of a nonlinear pendulum
The term nonlinear pendulum" is analogous to a retronym, a new name for an old thing to distinguish it from a new variation. For example, once upon a time a guitar was just a guitar. Now such a guitar is called an acoustic guitar to distinguish it from an electric guitar. Similarly, analog signal processing [...]The post Period of a nonlinear pendulum first appeared on John D. Cook.
Kepler triangle
A Kepler triangle is a right triangle whose sides are in geometric progression. That is, if the sides have length a < b < c, then b/a = c/b = k. All Kepler triangles are similar because the proportionality constant k can only take on one value. To see this, we first pick our units [...]The post Kepler triangle first appeared on John D. Cook.
Decoupling formal theorem proving effort
Terence Tao has been experimenting with formal theorem proving using Lean and writing about his experience. Here's something Tao said on Mathstodon that I thought was interesting. It is remarkable how much decoupling" is achieved by the Lean+Blueprint combo. Contributors can work locally on proving a lemma, without necessarily fully understanding the global proof structure. [...]The post Decoupling formal theorem proving effort first appeared on John D. Cook.
Partitioning dots and dashes
Given a set of dots and dashes, how many ways can they be partitioned into a set of Morse code letters? There is at least one way, since you could take each dot to be an E and each dash to be a T. If you have a sequence ofn dots and dashes, there no [...]The post Partitioning dots and dashes first appeared on John D. Cook.
Schwarz lemma, Schwarz-Pick theorem, and Poincare metric
Let D be the open unit disk in the complex plane. The Schwarz lemma says that if f is an analytic function from D to D with f(0) = 0, then for allz in D. The lemma also says more, but this post will focus on just this portion of the theorem. The Schwarz-Pick theorem [...]The post Schwarz lemma, Schwarz-Pick theorem, and Poincare metric first appeared on John D. Cook.
Factored random numbers
A couple days ago Michael Nielsen posted an image of a one-page paper that gives an algorithm for generating factored random numbers, uniformly distributed from 1 to some designated N. The algorithm does not generate random numbers then factor them. It's more efficient than that, generating the factorization along with the final result. It does [...]The post Factored random numbers first appeared on John D. Cook.
DICOM image data
The previous post discussed EXIF data embedded in a digital photo. DICOM files are analogous medical images. You can think of a DICOM image as a JPEG with medical metadata. Strictly speaking a DICOM file is a sort of database, and one of the fields in the database contains the pixels. The pixels are [...]The post DICOM image data first appeared on John D. Cook.
Personal information in digital photos
Is it possible to identify the people in the photo above? Maybe. Digital images potentially contain a large amount of metadata that could reveal the photographer's identify and location. There may also be a surprising number of clues in the photo itself. EXIF metadata The standard format for image metadata is EXIF, Exchangeable Image File [...]The post Personal information in digital photos first appeared on John D. Cook.
What can you learn from a phone number?
What can someone learn about you from your phone number? The answer depends on what other information someone has. Identifiers always depend on context. To a naked man in a tree [1] the phone number doesn't carry any information. But to someone with a list of names and phone numbers, some sort of reverse phone [...]The post What can you learn from a phone number? first appeared on John D. Cook.
Rational solution to Korteweg–De Vries equation
Students seeing differential equations for the first time expect every equation to have a nice closed-form solution, because up to that point in their education nearly every problem they've seen has been contrived to have a nice closed-form solution. Once you resign yourself to the fact that a differential equation will rarely have a closed [...]The post Rational solution to Korteweg-De Vries equation first appeared on John D. Cook.
Ruzsa distance and Ruzsa entropy warmup
This summer I wrote about Ruzsa distance and Ruzsa entropy. That earlier post would make a good warmup for reading Terence Tao's latest post On a conjecture of Martin.The post Ruzsa distance and Ruzsa entropy warmup first appeared on John D. Cook.
How to memorize a Bitcoin address
The latest episode of Darknet Diaries interviews someone using the pseudonym Default. He says in the interview that he had nearly a thousand Bitcoins (about $36 M) in a wallet stored on an external hard drive that was seized by federal agents when they raided his home. Default went to prison for five years for [...]The post How to memorize a Bitcoin address first appeared on John D. Cook.
US Census area hierarchy
Some kinds US Census geographic areas nest into a tidy hierarchy, but others do not. Here's a brief overview of both. Hierarchical entities The orderly hierarchy is nation region division state county census tract block group census block. All cleanly nested. There are four regions: West, Midwest, Northeast, and South. Each region splits into two [...]The post US Census area hierarchy first appeared on John D. Cook.
USPS tracking numbers
I noticed the other day that an app on my phone assumed that a long number was a USPS tracking number. I wondered how it decided that and did a little research. I assumed there was some structure to the number, at least a check sum if not more than that. This turned out to [...]The post USPS tracking numbers first appeared on John D. Cook.
Zero-Concentrated Differential Privacy
Differential privacy can be rigid and overly conservative in practice, and so finding ways to relax pure differential privacy while retaining its benefits is an active area of research. Two approaches to doing this are concentrated differential privacy [1] and Renyi differential privacy [3]. Concentrated differential privacy was used in reporting results from the 2020 [...]The post Zero-Concentrated Differential Privacy first appeared on John D. Cook.
Differentially private stochastic gradient descent
Let's work our way up to differentially private stochastic gradient descent (DP-SGD) a little at a time. We'll first look at gradient descent, then stochastic gradient descent, then finally differentially private stochastic gradient descent. Gradient descent We'll start with gradient descent. Suppose you have a function of several variables f(x) where x is a vector. [...]The post Differentially private stochastic gradient descent first appeared on John D. Cook.
Using dimensional analysis to check probability calculations
Probability density functions are independent of physical units. The normal distribution, for example, works just as well when describing weights or times. But sticking in units anyway is useful. Normal distribution example Suppose you're trying to remember the probability density function for the normal distribution. Is the correct form or or or maybe some other [...]The post Using dimensional analysis to check probability calculations first appeared on John D. Cook.
Randomized response and local differential privacy
Differential privacy protects user privacy by adding randomness as necessary to the results of queries to a database containing private data. Local differential privacy protects user privacy by adding randomness before the data is inserted to the database. Using the visualization from this post, differential privacy takes the left and bottom (blue) path through the [...]The post Randomized response and local differential privacy first appeared on John D. Cook.
PATE framework for differentially private machine learning
Machine learning models can memorize fragments of their training data and return these fragments verbatim. I've seen instances, for example, where I believe an LLM returned phrases verbatim from this site. It's easy to imagine how medical data might leak this way. How might you prevent this? And how might you do it in a [...]The post PATE framework for differentially private machine learning first appeared on John D. Cook.
Earth mover’s distance
There are many ways to describe the distance between two probability distributions. The previous two posts looked at using the p-norm to measure the difference between the PDFs and using Kullbach-Leibler divergence. Earth mover's distance (EMD) is yet another approach. Imagine a probability distribution on ^2 as a pile of dirt. Earth mover's distance measures [...]The post Earth mover's distance first appeared on John D. Cook.
KL divergence from normal to normal
The previous post looked at the best approximation to a normal density by normal density with a different mean. Dan Piponi suggested in the comments that it would be good to look at the Kullback-Leibler (KL) divergence. The previous post looked at the difference from between two densities from an analytic perspective, solving the problem [...]The post KL divergence from normal to normal first appeared on John D. Cook.
Normal approximation to normal
In my previous post on approximating a logistic distribution with a normal distribution I accidentally said something about approximating a normal with a normal. Obviously the best approximation to a probability distribution is itself. As Norbert Wiener said The best material model of a cat is another, or preferably the same, cat." But this made [...]The post Normal approximation to normal first appeared on John D. Cook.
Logistic / Normal approximation
In a recent post I pointed out that a soliton, a solution to the KdV equation, looks a lot like a normal density for fixed x. As someone pointed out in the comments, one way to look at this is that the soliton is exactly proportional to the density of a logistic distribution, and it's [...]The post Logistic / Normal approximation first appeared on John D. Cook.
Fax machines in the 21st century
Tens of millions of fax machines still exist. My business line gets calls from modems and fax machines fairly often. Maybe my number is close to that of a fax machine. Fax machines and health care Fax machines are especially common in health care. I remember when I was working at MD Anderson Cancer Center [...]The post Fax machines in the 21st century first appeared on John D. Cook.
Blog RSS feed
I got an email from someone saying the RSS feed for this site stopped working. Anyone else having this problem? I subscribe to my RSS feed and it's working fine for me. It may be that there are variations on the RSS feed, and the version I'm using works while the variation some others use [...]The post Blog RSS feed first appeared on John D. Cook.
Solitons and the KdV equation
Rarely does a nonlinear differential equation, especially a nonlinear partial differential equation, have a closed-form solution. But that is the case for the Korteweg-De Vries equation. (Technically I should say it's rare for a naturally-occurring nonlinear differential equation to have a closed-form solution. You can always start with a solution and cook up a contrived [...]The post Solitons and the KdV equation first appeared on John D. Cook.
A disk around Paris
The other day I saw an image of a large disk centered on Paris subjected to the Mercator projection. I was playing around in Mathematica and made similar images for different projections. Each image below is a disk of radius 4200 km centered on Paris (latitude 49, longitude 2). All images were produced with the [...]The post A disk around Paris first appeared on John D. Cook.
The 19th rule of HIPAA Safe Harbor
The HIPAA Safe Harbor provision says that data can be considered deidentified if 18 kinds of data are removed or reported at low resolution. At the end of the list of 18 items, there is an extra category, sometimes informally called the 19th rule: The covered entity does not have actual knowledge that the information [...]The post The 19th rule of HIPAA Safe Harbor first appeared on John D. Cook.
Bluesky
I saw a comment from Christos Argyropoulos on Twitter implying that there's a good scientific community on Bluesky, so I went there and looked around a little bit. I have account, but I haven't done much with it. I was surprised that a fair number of people had followed me on Bluesky even though I [...]The post Bluesky first appeared on John D. Cook.
Portable sed -i across MacOS and Linux
The -i flag to ask sed to edit a file in place works differently on Linux and MacOS. If you want to create a backup of your file before you edit it, say with the extension .bak, then on Linux you would run sed -i.bak myfile but for the version of sed that ships with [...]The post Portable sed -i across MacOS and Linux first appeared on John D. Cook.
Nearest, easiest, and most accessible
From Love What Lasts, Joshua Gibbs: ... there are too many things in the world to care equally about them all. The sheer volume of things ... demands that we have hierarchical standards by which to judge their value, or else we are condemned to give our lives over entirely to what is nearest, easiest, [...]The post Nearest, easiest, and most accessible first appeared on John D. Cook.
Johnson circle theorem
Draw three circles of radius r that intersect at a single point. Then draw a triangle connecting the remaining three points of intersection. (Each pair of circles intersects in two points, one of which is the point where all three circles intersect, so there are three other intersection points.) Then the circumcircle of the triangle, [...]The post Johnson circle theorem first appeared on John D. Cook.
Newton line
Let Q be a convex quadrilateral with at most two parallel sides. Draw the two diagonals then draw a line through their midpoints. This line is called the Newton line. (The requirement that at most two sides are parallel insures that the midpoints are distinct and so there is a unique line joining them.) In [...]The post Newton line first appeared on John D. Cook.
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.
...234567891011...