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
The IQ Test That AI Can’t Pass
Large language models have recently achieved remarkable test scores on well-known academic and professional exams (see, e.g., [1], p. 6). On such tests, these models are at times said to reach human-level performance. However, there is one test that humans can pass but every AI method known to have been tried has abysmally failed. The [...]The post The IQ Test That AI Can't Pass first appeared on John D. Cook.
New Twitter account for cryptography
I've started a new Twitter account: @CryptographyTip. The icon for the account is the symbol for XOR, a common operation in encryption. I intend to post about cryptography theory as well as practical matters such as software and file formats. You can find a list of my other technical twitter accounts here. You can also [...]The post New Twitter account for cryptography first appeared on John D. Cook.
Means of means bounding the logarithmic mean
The geometric, logarithmic, and arithmetic means of a and b are defined as follows. A few days ago I mentioned that G L A. The logarithmic mean slips between the geometric and arithmetic means. Or to put it another way, the logarithmic mean is bounded by the geometric and arithmetic means. You can [...]The post Means of means bounding the logarithmic mean first appeared on John D. Cook.
Base 64 encoding remainder problem
I've mentioned base 64 encoding a few times here, but I've left out a detail. This post fills in that detail. Base 64 encoding comes up in multiple contexts in which you want to represent binary data in text form. I've mentioned base 64 encoding in the context of Gnu ASCII armor. A more common [...]The post Base 64 encoding remainder problem first appeared on John D. Cook.
Binary to text to binary
Gnu Privacy Guard includes a way to encode binary files as plain ASCII text files, and turn these text files back into binary. This is intended as a way to transmit encrypted data, but it can be used to convert any kind of file from binary to text and back to binary. To illustrate this, [...]The post Binary to text to binary first appeared on John D. Cook.
Why “a caret, euro, trademark” ’ in a file?
Why might you see aTM in the middle of an otherwise intelligible file? The reason is very similar to the reason you might see , which I explained in the previous post. You might want to read that post first if you're not familiar with Unicode and character encodings. It all has to do with [...]The post Why a caret, euro, trademark" aTM in a file? first appeared on John D. Cook.
A valid character to represent an invalid character
You may have seen a web page with the symbol scattered throughout the text, especially in older web pages. What is this symbol and why does it appear unexpected? The symbol we're discussing is a bit of a paradox. It's the (valid) Unicode character to represent an invalid Unicode character. If you just read [...]The post A valid character to represent an invalid character first appeared on John D. Cook.
When zeros at natural numbers implies zero everywhere
Suppose a function f(z) equals 0 at z = 0, 1, 2, 3, .... Under what circumstances might you be able to conclude that f is zero everywhere? Clearly you need some hypothesis on f. For example, the function sin(z) is zero at every integer but certainly not constantly zero. Carlson's theorem says that if [...]The post When zeros at natural numbers implies zero everywhere first appeared on John D. Cook.
When High Performance Computing Is Not High Performance
Everybody cares about codes running fast on their computers. Hardware improvements over recent decades have made this possible. But how well are we taking advantage of hardware speedups? Consider these two C++ code examples. Assume here n = 10000000. void sub(int* a, int* b) { for (int i=0; i<n; ++i) a[i] = i + [...]The post When High Performance Computing Is Not High Performance first appeared on John D. Cook.
Leading zeros
The confusion between numbers such as 7 and 007 comes up everywhere. We know they're different-James Bond isn't Agent 7-and yet the distinction isn't quite trivial. How should software handle the two kinds of numbers? The answer isn't as simple as Do what the user expects" because different users have different expectations. Excel If you [...]The post Leading zeros first appeared on John D. Cook.
Ky Fan’s inequality
Let with each component satisfying 0 < xi 1/2. Define the complement x' by taking the complement of each entry. Let G andA represent the geometric and arithmetic mean respectively. Then Ky Fan's inequality says Now let H be the harmonic mean. Since in general H G A, you might guess that [...]The post Ky Fan's inequality first appeared on John D. Cook.
Previous digital signature standard expires next month
The Digital Signature Standard (DSS) FIPS 184-4, first published in 2013, expires a few days from now, on February 3, 2024. It is superseded by NIST FIPS 184-5. This new version was published on February 3, 2023, giving everyone a year to adopt the new new standard before it became required. The differences between the [...]The post Previous digital signature standard expires next month first appeared on John D. Cook.
Integral representations of means
The average of two numbers,a andb, can be written as the average of x over the interval [a, b]. This is easily verified as follows. The average is the arithemtic mean. We can represent other means as above if we generalize the pattern to be For the arithmetic mean, (x) = x. Logarithmic mean If [...]The post Integral representations of means first appeared on John D. Cook.
SierpiƄski’s inequality
Let An, Gn and Hn be the arithmetic mean, geometric mean, and harmonic mean of a set of n numbers. When n = 2, the arithmetic mean times the harmonic mean is the geometric mean squared. The proof is simple: When n > 2 we no longer have equality. However, W. Sierpiski, perhaps best known [...]The post Sierpiski's inequality first appeared on John D. Cook.
The Five Safes data privacy framework
The Five Safes decision framework was created a couple decades ago by Felix Ritchie at the UK Office for National Statistics. It is a framework for evaluating the safe use of confidential data, particularly by government agencies. You can find a description of the Five Safes, for example, in NIST SP 800-188. The Five Safes [...]The post The Five Safes data privacy framework first appeared on John D. Cook.
A curious pattern in January exponential sums
The exponential sum page on this site draws a new image every day based on plugging the month, day, and year into a formula. Some of these images are visually appealing; I've had many people ask if they could use the images in publications or on coffee mugs etc. The images generally look very different [...]The post A curious pattern in January exponential sums first appeared on John D. Cook.
The Million Dollar Matrix Multiply
The following post is by Wayne Joubert, the newest member of our consulting team. Wayne recently retired from his position as a Senior Computational Scientist at Oak Ridge National Laboratory. Training large language models like GPT-4 costs many millions of dollars in server expenses. These costs are expected to trend to billions of dollars over [...]The post The Million Dollar Matrix Multiply first appeared on John D. Cook.
Is there an elliptic curve with 2024 points?
On New Years Day I posted about groups of order 2024. Are there elliptic curves of order 2024? The Hasse-Weil theorem relates the number of points on an elliptic curve over a finite field to the number of elements of the field. Namely, an elliptic curve E over a field with q elements must have [...]The post Is there an elliptic curve with 2024 points? first appeared on John D. Cook.
Computing inverse factorial
I needed the inverse factorial function for my previous post. I was sure I'd written a post on computing the inverse factorial, and intended to reuse the code from that earlier post. But when I searched I couldn't find anything, so I'm posting the code here for my future reference and for anyone else who [...]The post Computing inverse factorial first appeared on John D. Cook.
Square root factorial
What factorial is closest to the square root of 2024 factorial? A good guess would be 1012, based on the idea that (n!) might be near (n/2)!. This isn't correct-the actual answer is 1112-but it's not wildly off. Could it be that (2n)! is asymptotically (n!)^2? No, Gauss' duplication formula shows that the ratio of [...]The post Square root factorial first appeared on John D. Cook.
Computing square root floor
Given an integer n, suppose you want to compute n, the greatest integer less than or equal to the square root of n. One reason you may want to compute n is to know when you can stop trial division when factoring n. Similarly, n gives you a starting point for Fermat's factorization algorithm. With [...]The post Computing square root floor first appeared on John D. Cook.
Groups of order 2024
This time last year I wrote about groups of order 2023 and now I'd like to do the same for 2024. There are three Abelian groups of order 2024, and they're not hard to find. We can factor 2024 = 8 * 11 * 23 and so the Abelian groups of order 2024 are of [...]The post Groups of order 2024 first appeared on John D. Cook.
Weak encryption and surveillance
Two of the first things you learn in cryptography are that simple substitution ciphers are very easy to break, and that security by obscurity is a bad idea. This post will revisit both of these ideas. Security depends on your threat model. If the threat you want to protect against is a human reading your [...]The post Weak encryption and surveillance first appeared on John D. Cook.
Randomize, then humanize
Yesterday I wrote about a way to memorize a random 256-bit encryption key. This isn't trivial, but it's doable using memory techniques. There's a much easier way to create a memorable encryption key: start with something memorable, then apply a hash function. Why not just do that? There are two conflicting criteria to satisfy: cryptographic [...]The post Randomize, then humanize first appeared on John D. Cook.
An unusual introduction to manifolds
Here is an introduction to manifolds (PDF, 23 MB) unlike any I've seen before. These notes by Brian Beckman devote a substantial amount of time to thinking about the problem of describing a location on a manifold, including an unexpected diversion into What3Words. The notes are in the form of a Mathematica notebook. The link [...]The post An unusual introduction to manifolds first appeared on John D. Cook.
Example of memorizing a 256-bit private key
There are techniques that can enable anyone to memorize much more than may seem possible. This post will show how I generated and memorized a 256-bit encryption key this morning using the approach explained here. TANSTAAFL There ain't no such thing as a free lunch. This saying is abbreviated TANSTAAFL in Heinlein's novel The Moon [...]The post Example of memorizing a 256-bit private key first appeared on John D. Cook.
Top twelve posts of 2023
These were the most popular posts I wrote in 2023. Privacy and encryption First names and Bayes' theorem What is the point of a public key fingerprint? RSA encryption in practice Geometry A pentagon, hexagon, and decagon walk into a bar (source of the image above) Calculating the intersection of two circles Number theory Every [...]The post Top twelve posts of 2023 first appeared on John D. Cook.
Doomsday 2024
John Conway's Doomsday" rule observes that that every year, the dates 4/4, 6/6, 8/8, 10/10, 12/12, 5/9, 9/5, 7/11, and 11/7 fall on the same day of the week. In 2024 all these dates fall on a Thursday. These dates are easy to memorize because they break down in double pairs of even digits-4/4, 6/6, [...]The post Doomsday 2024 first appeared on John D. Cook.
Addition theorems for Dixon functions
The last couple blog posts have been about Dixon elliptic functions, functions which are analogous in some ways to sine and cosine functions. Whereas sine and cosine satisfy a Pythagorean identity the Dixon functions sm and cm satisfy what you might call a Fermat identity alluding to Fermat's last theorem. The functions sm and cm [...]The post Addition theorems for Dixon functions first appeared on John D. Cook.
Fermat curve
The Fermat curve of ordern is the set of points satisfying xn + yn = 1 for a positive integer n. Fermat's last theorem is equivalent to saying there are no non-trivial rational points on the Fermat curve of order n > 2. (The trivial points have x or y equal to 0.) Parameterization The [...]The post Fermat curve first appeared on John D. Cook.
Conformal map between disk and equilateral triangle
The Dixon elliptic functions sm and cm are in some ways analogous to sine and cosine. However, whereas sine and cosine satisfy the Dixon functions satisfy The exponent 3 foreshadows the fact that these functions have a sort of three-fold symmetry. In particular, the function sm maps an equilateral triangle in the complex plane to [...]The post Conformal map between disk and equilateral triangle first appeared on John D. Cook.
Integrals involving secants and tangents
As a student, I often made the mistake of thinking that if I knew a more powerful theorem, I didn't need to learn a less powerful theorem. The reason this is a mistake is that the more powerful theorem may be better by one obvious criterion but not be better by other less-obvious criteria. The [...]The post Integrals involving secants and tangents first appeared on John D. Cook.
What is the point of a public key fingerprint?
Public key cryptography uses two keys: a private key and a public key. The nature of these keys depends on the encryption scheme, such as whether one is using RSA, ECC, or some other method, but you can think of a key as a long number. A key may be a short list of numbers, [...]The post What is the point of a public key fingerprint? first appeared on John D. Cook.
Fine-grained file differences
The diff utility compares files by lines, which is often what you'd like it to do. But sometimes you'd like more granularity. For example, supposed we want to compare two versions of Psalm 23. Here are the first three verses in the King James version: The Lord is my shepherd; I shall not want. He [...]The post Fine-grained file differences first appeared on John D. Cook.
The ed line editor: bravado, utility, and history
I stumbled on the book Ed Mastery by Michael W. Lucas and couldn't tell immediately whether it was serious. In a sort of technical version of Poe's law, Lucas lays on the technical machismo pretty thick, but not thicker than some people do unironically. Bravado Here's a paragraph from early in the book. Many younger [...]The post The ed line editor: bravado, utility, and history first appeared on John D. Cook.
sin(cos(x)) versus cos(sin(x))
A few days ago I wrote about sufficient conditions for f(g(x)) to bound g(f(x)). This evening I stumbled on an analogous theorem. For real numbers and , cos( sin(x)) > sin( cos(x)) for all real x provided ^2 + ^2 < (/2)^2. Source: American Mathematical Monthly. February 2009. Solution to problem 11309, page 184. [...]The post sin(cos(x)) versus cos(sin(x)) first appeared on John D. Cook.
Rectangles to Rectangles
There is a conformal map between any two simply connected open proper subsets of the complex plane. This means, for example, there is a one-to-one analytic map from the interior of a square onto the interior of a a circle. Or from the interior of a triangle onto the interior of a pentagon. Or from [...]The post Rectangles to Rectangles first appeared on John D. Cook.
ASCII armor: send encrypted data in plain text
GnuPG ASCII armor is a way to encode binary data as text and decode the text back into binary. It could be used with any binary data, but most often it is used with cryptographic data: public keys, encrypted messages, etc. Secure communication over an insecure channel When people ask whether some medium supports encryption," [...]The post ASCII armor: send encrypted data in plain text first appeared on John D. Cook.
Why not reuse passwords?
Perhaps you've heard that you should not reuse passwords but don't understand why. After all, you have a really good password, one that nobody would ever guess, so why not use it everywhere? Your password is not as good as you think First of all, people who think they have a really good password are [...]The post Why not reuse passwords? first appeared on John D. Cook.
The world’s sneakiest substitution
Something that seems like an isolated trick may turn out to be much more important. This is the case with a change of variables discovered by Karl Weierstrass. Every calculus student learns a handful of standard techniques: u-substitutions, partial fractions, integration by parts, and trig substitutions. Then there is one more technique that is like [...]The post The world's sneakiest substitution first appeared on John D. Cook.
f(g(x)) versus g(f(x))
I stumbled upon a theorem today that I feel like I've needed in the past, though I can't remember any particular applications. I'm writing it up here as a note to my future self should the need reappear. The theorem gives sufficient conditions to conclude f(g(x)) g(f(x)) and uses this to prove, for example, [...]The post f(g(x)) versus g(f(x)) first appeared on John D. Cook.
Constellations in Mathematica
Mathematica has data on stars and constellations. Here is Mathematica code to create a list of constellations, sorted by the declination (essentially latitude on the celestial sphere) of the brightest star in the constellation. constellations = EntityList["Constellation"] sorted = SortBy[constellations, -#["BrightStars"][[1]]["Declination"] &] We can print the name of each constellation with Map[#["Name"] &, sorted] This [...]The post Constellations in Mathematica first appeared on John D. Cook.
222nd Carnival of Mathematics
A blog carnival is a round up of recent blog posts. The Carnival of Mathematics is a long-running carnival of blog posts on mathematical topics. This is the 222nd edition of the carnival. Facts about 222 By longstanding tradition, the nth Carnival of Mathematics must begin with trivia about the number n, and so here [...]The post 222nd Carnival of Mathematics first appeared on John D. Cook.
Bounding complex roots by a positive root
Suppose you have an nth degree polynomial with complex coefficients p(z) = anzn + an-1zn-1 + ... + a0 and you want to find some circle that is guaranteed to contain all the zeros of p. Cauchy found such a circle in 1829. The zeros of p lie inside the circle |z| r where [...]The post Bounding complex roots by a positive root first appeared on John D. Cook.
Convergent subsequence
I was reading a theorem giving conditions for a divergent series to have a convergent subseries and had a sort of flashback. I studied nonlinear PDEs in grad school, which amounted to applied functional analysis. We were constantly proving or using theorems about sequences having convergent subsequences, often subsequences that converged in a very weak [...]The post Convergent subsequence first appeared on John D. Cook.
How to memorize the periodic table
Motivation Memorizing the periodic table has some practical value, especially if you're a chemist, but in any case it's an interesting exercise, easier to do than it may sound. And it's a case study for how you might memorize other things of more practical value to you personally. Major system pegs The Major system is [...]The post How to memorize the periodic table first appeared on John D. Cook.
Solving a triangle the size of Argentina
The numbers in today's date-11, 28, and 23-make up the sides of a triangle. This doesn't always happen; the two smaller numbers have to add up to more than the larger number. We'll look at triangles with sides 11, 23, and 28 in the plane, on a sphere, and on a hypersphere. Most of the [...]The post Solving a triangle the size of Argentina first appeared on John D. Cook.
Unix linguistics
If you knew that you wanted to learn 10 spoken languages, it would probably be helpful to take a course in linguistics first. Or maybe to have a linguistics course after learning your first or second language. And if the languages are related, it would help to know something about the linguistics of that group [...]The post Unix linguistics first appeared on John D. Cook.
Numerical integral with a singularity
Richard Hamming [1] gives this nice example of an integral with a mild singularity: The integrand approaches - as x approaches 0 and yet the integral is finite. If we try into numerically evaluate this integral, we will either get inaccurate results or we will have to go to a lot of work. This post [...]The post Numerical integral with a singularity first appeared on John D. Cook.
Radius of a stretched spring
When you stretch a coiled spring, the radius decreases slightly, so slightly that you can't see the difference unless you stretch the spring so much that you damage it. The math is essentially the same as in the previous post about wrapping Christmas lights around a tree trunk. If you have a coiled spring of [...]The post Radius of a stretched spring first appeared on John D. Cook.
12345678910...