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-11-22 09:03
Gravity on Jupiter
I was listening to the latest episode of the Space Rocket History podcast. The show includes some audio from a documentary on Pioneer 11 that mentioned that a man would weigh 500 pounds on Jupiter. My immediate thought was Is that all?! Is this man' a 100 pound boy?" The documentary was correct and my [...]The post Gravity on Jupiter first appeared on John D. Cook.
Are guidance documents laws?
Are guidance documents laws? No, but they can have legal significance. The people who generate regulatory guidance documents are not legislators. Legislators delegate to agencies to make rules, and agencies delegate to other organizations to make guidelines. For example [1], Even HHS, which has express cybersecurity rulemaking authority under the Health Insurance Portability and Accountability [...]The post Are guidance documents laws? first appeared on John D. Cook.
More Laguerre images
A week or two ago I wrote about Laguerre's root-finding method and made some associated images. This post gives a couple more examples. Laguerre's method is very robust in the sense that it is likely to converge to a root, regardless of the starting point. However, it may be difficult to predict which root the [...]The post More Laguerre images first appeared on John D. Cook.
A Bayesian approach to proving you’re human
I set up a GitHub account for a new employee this morning and spent a ridiculous amount of time proving that I'm human. The captcha was to listen to three audio clips at a time and say which one contains bird sounds. This is a really clever test, because humans can tell the difference between [...]The post A Bayesian approach to proving you're human first appeared on John D. Cook.
Antenna length: Another rule of 72
The famous Rule of 72 says that to find out how many years it takes an investment to double in value, divide 72 by the annual percentage rate. I'll come back to that in a little bit. This morning I read a really good article, Fifty Things you can do with a Software Defined Radio. [...]The post Antenna length: Another rule of 72 first appeared on John D. Cook.
Hallucinations of AI Science Models
AlphaFold 2, FourCastNet and CorrDiff are exciting. AI-driven autonomous labs are going to be a big deal [1]. Science codes now use AI and machine learning to make scientific discoveries on the world's most powerful computers [2]. It's common practice for scientists to ask questions about the validity, reliability and accuracy of the mathematical and [...]The post Hallucinations of AI Science Models first appeared on John D. Cook.
Double super factorial
I saw someone point out recently that 10! = 7! * 5! * 3! * 1! Are there more examples like this? What would you call the pattern on the right? I don't think there's a standard name, but here's why I think it should be called double super factorial or super double factorial. Super [...]The post Double super factorial first appeared on John D. Cook.
Laguerre’s root finding method
Edmond Laguerre (1834-1886) came up with a method for finding zeros of polynomials. Unlike Newton's method for finding zeros of general functions, Laguerre's method is specialized for polynomials. Laguerre's method converges an order of magnitude faster than Newton's method, i.e. the error is cubed on each step rather than squared. The most interesting thing about [...]The post Laguerre's root finding method first appeared on John D. Cook.
Breach Safe Harbor
In the context of medical data, Safe Harbor typically refers to the Safe Harbor provisions of the HIPAA Privacy Rule explained here. Breach Safe Harbor is a little different. It basically means you're off the hook if you breach encrypted health data. (But not necessarily. More on that below.) I'm not a lawyer, so this [...]The post Breach Safe Harbor first appeared on John D. Cook.
MD5 hash collision example
Marc Stevens gave an example of two alphanumeric strings that differ in only one byte that have the same MD5 hash value. It may seem like beating a dead horse to demonstrate weaknesses in MD5, but it's instructive to study the flaws of broken methods. And despite the fact that MD5 has been broken for [...]The post MD5 hash collision example first appeared on John D. Cook.
Distance from a point to a line
Eric Lengyel's new book Projective Geometric Algebra Illuminated arrived yesterday and I'm enjoying reading it. Imagine if someone started with ideas like dot products, cross products, and determinants that you might see in your first year of college, then thought deeply about those things for years. That's kinda what the book is. Early in the [...]The post Distance from a point to a line first appeared on John D. Cook.
Experiences with Thread Programming in Microsoft Windows
Lately I've been helping a colleague to add worker threads to his GUI-based Windows application. Thread programming can be tricky. Here are a few things I've learned along the way. Performance. This app does compute-intensive work. It is helpful to offload this very compute-heavy work to a worker thread. Doing this frees the main thread [...]The post Experiences with Thread Programming in Microsoft Windows first appeared on John D. Cook.
Accelerating Archimedes
One way to approximate is to find the areas of polygons inscribed inside a circle and polygons circumscribed outside the circle. The approximation improves as the number of sides in the polygons increases. This idea goes back at least as far as Archimedes (287-212 BC). Maybe you've tried this. It's a lot of work. [...]The post Accelerating Archimedes first appeared on John D. Cook.
How much will a cable sag? A simple approximation
Suppose you have a cable of length 2s suspended from two poles of equal height a distance 2x apart. Assuming the cable hangs in the shape of a catenary, how much does it sag in the middle? If the cable were pulled perfectly taut, we would have s = x and there would be no [...]The post How much will a cable sag? A simple approximation first appeared on John D. Cook.
Unique letter patterns in words
The word Mississippi has a unique pattern of letters. If you were solving a cryptogram puzzle and saw ZVFFVFFVCCV you might guess that the word is Mississippi. Is the pattern of letters in Mississippi literally unique or just uncommon? What is the shortest word with a unique letter pattern? The longest word? We can answer [...]The post Unique letter patterns in words first appeared on John D. Cook.
How to Organize Technical Research?
64 million scientific papers have been published since 1996 [1]. Assuming you can actually find the information you want in the first place-how can you organize your findings to be able to recall and use them later? It's not a trifling question. Discoveries often come from uniting different obscure pieces of information in a [...]The post How to Organize Technical Research? first appeared on John D. Cook.
A surprising result about surprise index
Surprise index Warren Weaver [1] introduced what he called the surprise index to quantify how surprising an event is. At first it might seem that the probability of an event is enough for this purpose: the lower the probability of an event, the more surprise when it occurs. But Weaver's notion is more subtle than [...]The post A surprising result about surprise index first appeared on John D. Cook.
Estimating an author’s vocabulary
How would you estimate the size of an author's vocabulary? Suppose you have a analyzed the author's available works and found n words, x of which are unique. Then you know the author's vocabulary was at least x, but it's reasonable to assume that the author may have know words he never used in writing, [...]The post Estimating an author's vocabulary first appeared on John D. Cook.
Detecting the language of encrypted text
Imagine you are a code breaker living a century ago. You've intercepted a message, and you go through your bag of tricks, starting with the simplest techniques first. Maybe the message has been encrypted using a simple substitution cipher, so you start with that. Simple substitution ciphers can be broken by frequency analysis: the most [...]The post Detecting the language of encrypted text first appeared on John D. Cook.
Blow up in finite time
A few years ago I wrote a post about approximating the solution to a differential equation even though the solution did not exist. You can ask a numerical method for a solution at a point past where the solution blows up to infinity, and it will dutifully give you a finite solution. The result is [...]The post Blow up in finite time first appeared on John D. Cook.
Normal subgroups are subtle
The definition of a subgroup is obvious, but the definition of a normal subgroup is subtle. Widgets and subwidgets The general pattern of widgets and subwidgets is that a widget is a set with some kind of structure, and a subwidget is a subset that has the same structure. This applies to vector spaces and [...]The post Normal subgroups are subtle first appeared on John D. Cook.
Finite differences and Pascal’s triangle
The key to solving a lot of elementary what-number-comes-next puzzles is to take first or second differences. For example, if asked what the next item in the series 14, 29, 50, 77, 110, ... the answer (or at lest the answer the person posing the question is most likely looking for) is 149. You might [...]The post Finite differences and Pascal's triangle first appeared on John D. Cook.
Archiving data on paper
This is a guest post by Ondej ertik. Ondej formerly worked at Los Alamos National Labs and now works for GSI Technologies. He is known in the Python community for starting the SymPy project and in the Fortran community for starting LFortran. - John I finally got to experiment a bit with archiving data [...]The post Archiving data on paper first appeared on John D. Cook.
Emails moved to Substack
Until recently I used two email services: one to send out daily blog post announcements and another for monthly blog highlights. I've combined these into one Substack account for weekly blog highlights. Apparently readers really like this move. Daily and monthly email subscriptions flatlined some time ago, but Substack subscriptions are going up steadily. Substack [...]The post Emails moved to Substack first appeared on John D. Cook.
What’s the Best Code Editor?
Emacs, vi, TextEdit, nano, Sublime, Notepad, Wordpad, Visual Studio, Eclipse, etc., etc.-everyone's got a favorite. I used Visual Studio previously and liked the integrated debugger. Recently I started using VS again and found the code editing windows rather cluttered. Thankfully you can tone this down, if you can locate the right options. Eclipse for Java [...]The post What's the Best Code Editor? first appeared on John D. Cook.
Bounding the perimeter of a triangle between circles
Suppose you have a triangle and you know the size of the largest circle that can fit inside (the incircle) and the size of the smallest circle that can fit outside (the circumcircle). How would you estimate the perimeter of the triangle? In terms of the figure below, if you know the circumference of the [...]The post Bounding the perimeter of a triangle between circles first appeared on John D. Cook.
Music of the spheres
The idea of music of the spheres" dates back to the Pythagoreans. They saw an analogy between orbital frequency ratios and musical frequency ratios. HD 110067 is a star 105 light years away that has six known planets in orbital resonance. The orbital frequencies of the planets are related to each other by small integer [...]The post Music of the spheres first appeared on John D. Cook.
The Real Book
I listened to the 99% Invisible podcast about The Real Book this morning and thought back to my first copy. My first year in college I had a jazz class, and I needed to get a copy of The Real Book, a book of sheet music for jazz standards. The book that was illegal at [...]The post The Real Book first appeared on John D. Cook.
Substack replacing email subscription
The service that sent out my email to blog subscribers stopped working a couple weeks ago, and I'm trying out Substack as a replacement. You can find my Substack account here. My plan for now is to use this account to make blog post announcements, maybe once a week, with a little introductory commentary for [...]The post Substack replacing email subscription first appeared on John D. Cook.
Determinant of an infinite matrix
What does the infinite determinant mean and when does it converge? The determinant D above is the limit of the determinants Dn defined by If all the as are 1 and all the bs are -1 then this post shows that Dn = Fn, the nth Fibonacci number. The Fibonacci numbers obviously don't converge, so [...]The post Determinant of an infinite matrix first appeared on John D. Cook.
Area of quadrilateral as a determinant
I've written several posts about how determinants come up in geometry. These determinants often look similar, having columns related to coordinates and a column of ones. You can find several examples here along with an explanation for this pattern. If you have three points z1, z2, and z3 in the complex plane, you can find [...]The post Area of quadrilateral as a determinant first appeared on John D. Cook.
A very accurate logarithm approximation
The previous post looked at an efficient way to approximate nth roots of fractions near 1 by hand. This post does the same for logarithms. As before, we assume x = p/q and define s = p + q d = p - q Because we're interested in values of x near 1, d is [...]The post A very accurate logarithm approximation first appeared on John D. Cook.
Handy approximation for roots of fractions
This post will discuss a curious approximation with a curious history. Approximation Let x be a number near 1, written as a fraction x = p / q. Then define s and d as the sum and difference of the numerator and denominator. s = p + q d = p - q Since we [...]The post Handy approximation for roots of fractions first appeared on John D. Cook.
Uncovering names masked with stars
Sometimes I'll see things like my name partially concealed as J*** C*** and think a lot of good that does." Masking letters reveals more than people realize. For example, when you see that someone's first name is four letters and begins with J, there's about a 70% chance they're male and there's a 44% chance [...]The post Uncovering names masked with stars first appeared on John D. Cook.
Almost ASCII
I was working recently with a gigabyte file that had a dozen non-ASCII characters. This is very common. The ASCII character set is not quite big enough for a lot of tasks. Of course it's completely inadequate if you're writing Japanese, but it's almost enough for documents written in English and a few other languages. [...]The post Almost ASCII first appeared on John D. Cook.
A knight’s tour of an infinite chessboard
Let ^2 be the lattice of points in the plane with integer coordinates. You could think of these points as being the centers of the squares in a chessboard extending to infinity in every direction. Cantor tells us that the points in ^2 are countable. What's more surprising is that you could count the points [...]The post A knight's tour of an infinite chessboard first appeared on John D. Cook.
Natural one-liners
I learned to use Unix in college-this was before Linux-but it felt a little mysterious. Clearly it was developed by really smart people, but what were the problems that motivated their design choices? Some of these are widely repeated. For example, commands have terse names because you may have to transmit commands over a glacial [...]The post Natural one-liners first appeared on John D. Cook.
When is less data less private?
If I give you a database, I give you every row in the database. So if you delete some rows from the database, you have less information, not more, right? This seems very simple, and it mostly is, but there are a couple subtleties. A common measure in data privacy is k-anonymity. The idea is [...]The post When is less data less private? first appeared on John D. Cook.
Additive functions
A functionf from positive integers to real numbers is defined to be additive if for relatively prime numbers m and n, f(mn) = f(m) + f(n). The function f is called completely addititive if the above holds for all positive integers m and n, i.e. we drop the requirement that m and n are relatively [...]The post Additive functions first appeared on John D. Cook.
Frequency analysis
Suppose you have a list of encrypted surnames names of US citizens. If the list is long enough, the encrypted name that occurs most often probably corresponds to Smith. The second most common encrypted name probably corresponds to Johnson, and so forth. This kind of inference is analogous to solving a cryptogram puzzle by counting [...]The post Frequency analysis first appeared on John D. Cook.
Security by obscurity
Security-by-obscurity is a bad idea in general. It's better, for example, to have a login page than to give your site an obscure URL. It's better to encrypt a file than to hide it in some odd directory. It's better to use a well-vetted encryption algorithm than to roll your own. There there are people [...]The post Security by obscurity first appeared on John D. Cook.
Advanced questions about a basic diagram
I saw a hand-drawn version of the diagram above yesterday and noticed that the points were too evenly distributed. That got me to thinking: is there any objective way to say that this famous diagram is in some sense complete? If you were to make a diagram with more points, what would they be? Simple [...]The post Advanced questions about a basic diagram first appeared on John D. Cook.
How much metadata is in a photo?
A few days ago I wrote about the privacy implications of metadata in a PDF. This post will do the same for photos. You can see the metadata in a photo using exiftool. By default cameras include time and location data. I ran this tool on a photo I took in Seattle a few years [...]The post How much metadata is in a photo? first appeared on John D. Cook.
The Borwein integrals
The Borwein integrals introduced in [1] are a famous example of how proof-by-example can go wrong. Define sinc(x) as sin(x)/x. Then the following equations hold. However where 2.3 * 10-11. This is where many presentations end, concluding with the moral that a pattern can hold for a while and then stop. But I'd [...]The post The Borwein integrals first appeared on John D. Cook.
Avoiding Multiprocessing Errors in Bash Shell
Suppose you have two Linux processes trying to modify a file at the same time and you don't want them stepping on each other's work and making a mess. A common solution is to use a lock" mechanism (a.k.a. mutex"). One process locks the lock" and by this action has sole ownership of a [...]The post Avoiding Multiprocessing Errors in Bash Shell first appeared on John D. Cook.
This-way-up and Knuth arrows
I was looking today at a cardboard box that had the this way up" symbol on it and wondered whether there is a Unicode value for it. Apparently not. But there is an ISO code for it: ISO 7000 symbol 0623. It's an international standard symbol for indicating how to orient a package. The name [...]The post This-way-up and Knuth arrows first appeared on John D. Cook.
Factoring pseudoprimes
Fermat's little theorem says that if p is a prime number, then for any positive integer b < p we hve bp-1 = 1 (mod p). This theorem gives a necessary but not sufficient condition for a number to be prime. Fermat's primality test The converse of Fermat's little theorem is not always true, but [...]The post Factoring pseudoprimes first appeared on John D. Cook.
Do comments in a LaTeX file change the output?
When you add a comment to a LaTeX file, it makes no visible change to the output. The comment is ignored as far as the appearance of the file. But is that comment somehow included in the file anyway? If you compile a LaTeX file to PDF, then edit it by throwing in a comment, [...]The post Do comments in a LaTeX file change the output? first appeared on John D. Cook.
Your PDF may reveal more than you intend
When you create a PDF file, what you see is not all you get. There is metadata embedded in the file that might be useful. It also might reveal information you'd rather not reveal. The previous post looked at just the time stamp on a file. This post will look at more metadata, focusing on [...]The post Your PDF may reveal more than you intend first appeared on John D. Cook.
If you save a file as PDF twice, you get two different files
If you save a file as a PDF twice, you won't get exactly the same file both times. To illustrate this, I created an LibreOffice document containing Hello world." and saved it twice, first as humpty.pdf then as dumpty.pdf. Then I compared the two files. % diff humpty.pdf dumpty.pdf Binary files humpty.pdf and dumpty.pdf differ [...]The post If you save a file as PDF twice, you get two different files first appeared on John D. Cook.
...78910111213141516...