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-22 13:31
Quaternion products with fewer real products
A couple days ago I wrote about Gauss’ trick to multiply two complex numbers using only 3 real multiplications. This post will do something similar with quaternions. Just as the most direct approach to computing complex products requires 4 real multiplications, the most direct approach to quaternion products requires 16 real multiplications. (See the function […]The post Quaternion products with fewer real products first appeared on John D. Cook.
Faster quaternion product rotations
You can use quaternions to describe rotations and quaternion products to carry out these rotations. These products have the form qpq* where q represents a rotation, q* is its conjugate, and p is the the vector being rotated. (That’s leaving out some details that we’ll get to shortly.) The primary advantage of using quaternions to […]The post Faster quaternion product rotations first appeared on John D. Cook.
Three kinds of tensor
I’ve written before about how the word “tensor” is applied to several different things, and that the connection between them isn’t immediately obvious. I thought about writing more about that some day, but I recently became aware of a paper that does this more thoroughly than I ever could. The paper looks at three notions […]The post Three kinds of tensor first appeared on John D. Cook.
Laplacian in various coordinate systems
The recent post on the wave equation on a disk showed that the Laplace operator has a different form in polar coordinates than it does in Cartesian coordinates. In general, the Laplacian is not simply the sum of the second derivatives with respect to each variable. Mathematica has a function, unsurprisingly called Laplacian, that will […]The post Laplacian in various coordinate systems first appeared on John D. Cook.
Gauss algorithm for complex multiplication
The most straight-forward way of multiplying two complex numbers requires four multiplications of real numbers: def mult(a, b, c, d): re = a*c - b*d im = b*c + a*d return (re, im) Gauss [1] discovered a way to do this with only three multiplications: def gauss(a, b, c, d): t1 = a*c t2 = […]The post Gauss algorithm for complex multiplication first appeared on John D. Cook.
Vibrating circular membranes
This post will tie together many things I’ve blogged about before. The previous post justified separation of variables. This post will illustrate separation of variables. Also, this post will show why you might care about Bessel functions and their zeros. I’ve written about Bessel functions before, and said that Bessel functions are to polar coordinates […]The post Vibrating circular membranes first appeared on John D. Cook.
Justifying separation of variables
The separation of variables technique for solving partial differential equations looks like a magic trick the first time you see it. The lecturer, or author if you’re more self-taught, makes an audacious assumption, like pulling a rabbit out of a hat, and it works. For example, you might first see the heat equation ut = […]The post Justifying separation of variables first appeared on John D. Cook.
Visual geometry
If you’re puzzled by the title of this post, allow me to explain. A natural reaction would be “Isn’t geometry intrinsically visual?” Indeed, geometry is motivated by things we can visualize. But modern developments of geometry have become heavy with formal machinery, so much so that one could reasonably ask “What happened to the geometry?” […]The post Visual geometry first appeared on John D. Cook.
Volunteer-generated errata pages
I picked up a used copy of Quaternions and Rotation Sequences by Jack B. Kuipers for a project I’m starting to work on. The feedback I’ve seen on the book says it has good content but also has lots of typos. My copy has a fair number of corrections that someone penciled in. Someone on […]The post Volunteer-generated errata pages first appeared on John D. Cook.
Random drug screening
Suppose in a company of N employees, m are chosen randomly for drug screening. In two independent screenings, what is the probability that someone will be picked both times? It may be unlikely that any given individual will be picked twice, while being very likely that someone will be picked twice. Imagine m employees being […]The post Random drug screening first appeared on John D. Cook.
Blog email subscription
As I mentioned a couple weeks ago, Feedburner, the service I’ve been using for blog email subscriptions, is shutting down. I’m switching over to MailerLite. The new email subscription is up and running. You can sign up here if you’d like. If you’re already subscribed via Feedburner, there’s no need to sign up again with […]The post Blog email subscription first appeared on John D. Cook.
Recommending division
A friend and I were discussing how to analyze his data one time and at the end of the conversation he said “So, basically you’re recommending division.” And indeed I was. The conclusion was to divide one thing by another. I’ve also recommended to clients that they use an extended Kalman filter or homomorphic encryption; […]The post Recommending division first appeared on John D. Cook.
Fourier, Gauss, and Heisenberg
Several weeks ago I wrote about the Fourier uncertainty principle which gives a lower bound on the product of the variance of a function f and the variance of its Fourier transform. This post expands on the earlier post by quoting some results from a recent paper [1]. Gaussian density The earlier post said that the […]The post Fourier, Gauss, and Heisenberg first appeared on John D. Cook.
More readable lambda calculus
Lambda calculus is simple. The definitions and rules of lambda calculus would easily fit on an index card. But you can’t really “read” lambda calculus so much as you can mentally execute it. Not many people can look at more than a few characters of lambda calculus and have any idea what it represents, though […]The post More readable lambda calculus first appeared on John D. Cook.
What does RIPEMD stand for?
The RIPEMD-160 secure hash function may be best known these days for its role as part of the implementation of Bitcoin. I’ve wondered what “RIPEMD” stands for, and today I stumbled on an explanation [1]: “RIPEMD” stands for “RIPE Message Digest,” where “RIPE” stands for “RACE Integrity Primitives Evaluation” and where “RACE” stands for “Research […]The post What does RIPEMD stand for? first appeared on John D. Cook.
Time dilation in SF and GPS
I’m reading Voyage to Alpha Centauri and ran into a question about relativity. The book says in one place that their ship is moving a 56.7% of the speed of light, and in another place it says that time moves about 20% slower for them relative to folks on Earth. Are those two statements consistent? […]The post Time dilation in SF and GPS first appeared on John D. Cook.
A gentle introduction to QMC and discrepancy
The previous post looked at the sequence kn mod 1 where k = log2(3). This value of k arose out of exploring perfect fifths and octaves. We saw that the sequence above fills in the unit interval fairly well, though not exactly regularly. The first 12 elements of the sequence nearly divide the unit interval […]The post A gentle introduction to QMC and discrepancy first appeared on John D. Cook.
Perfect fifths, octaves, and an ergodic map
In music, a perfect fifth is the interval between two notes whose frequencies are in 3:2 ratio. For example, the interval from an A at 440 Hz and an E at 660 Hz is a perfect fifth. Going up by 12 perfect fifths is very nearly the same as going up 7 octaves. That is, […]The post Perfect fifths, octaves, and an ergodic map first appeared on John D. Cook.
Zareba, asterism, and dinkus
Occasionally I will use a row of three asterisks to indicate the separation between the body of a blog post and the footnotes, as I did in my previous post. *** This page quotes a typesetter who said she calls this a zareba. The OED defines a zareba as a kind of cattle pen but […]The post Zareba, asterism, and dinkus first appeared on John D. Cook.
A unique property of sine
The following trig identity looks like a mistake but is correct: sin(x + y) sin(x – y) = (sin(x) + sin(y)) (sin(x) – sin(y)) It looks as if someone fallaciously expanded sin(x + y) “=” sin(x) + sin(y) and sin(x – y) “=” sin(x) – sin(y). Although both expansions are wrong, their product is correct. […]The post A unique property of sine first appeared on John D. Cook.
Information theory and coordinates
The previous post explains how the Maidenhead location system works. The first character in a location code specifies the longitude in 20 degree increments and the second character specifies the latitude in 10 degree increments. Both are a letter from A through R that breaks the possible range down into 18 parts. (The longitude range […]The post Information theory and coordinates first appeared on John D. Cook.
Maidenhead geocode system
The Maidenhead Locator System encodes a pair of longitude and latitude coordinates in a slightly complicated but ingenious way. Amateur radio operators using this geocoding system to describe locations. The Wikipedia article on the subject describes the what of the system, but I’d like to say more about the why of the system. I’ll also […]The post Maidenhead geocode system first appeared on John D. Cook.
Plastic number feels plastic
The plastic ratio is given by The Dutch architect Dom Hans van der Laan gave the number this name in 1928. He used “plastic” as an allusion to a 3D construction of the number, analogous to the 2D construction of the golden ratio. Here’s a plastic rectangle, a rectangle whose sides have the proportions of […]The post Plastic number feels plastic first appeared on John D. Cook.
Coin distribution
What is the distribution of coins you’d expect to see in a coin jar? This post will make a guess based on the following simplifying assumptions. Change is in US currency, with coins in denominations of 1, 5, 10, and 25 cents. The change due in a transaction is uniformly distributed from 0 to 99 […]The post Coin distribution first appeared on John D. Cook.
Why exponential sums are interesting
The exponential sum page on this site draws lines between the consecutive partial sums of where m is the month, d is the day, and y is the last two digits of the year. I get mixed feedback on my exponential sum page. Some people find it even more interesting than I do and have […]The post Why exponential sums are interesting first appeared on John D. Cook.
LaTeX and Lawyers
Lawyers write Word documents and mathematicians write LaTeX documents. Of course makes collaboration awkward, but there are ways to make it better. One solution is to simply use Word. People who use LaTeX probably know how to use Word, even if they’d rather not, and asking someone else to learn LaTeX is a non-starter. So […]The post LaTeX and Lawyers first appeared on John D. Cook.
A Pattern Language
I first heard of the book A Pattern Language sometime in the 1990s. I had left academia, for the first time [1], and was working as a software developer. Although the book is about architecture, software developers were exited about the book because of its analogs to software development patterns. The “Gang of Four” book […]The post A Pattern Language first appeared on John D. Cook.
Email subscription changing
Email subscription for this web site has been provided by Google Feedburner. This service is going away in July. I don’t know yet what I will replace Feedburner with. Do any of you know of an alternative that automatically sends out email when there’s a new post? I use Mail Chip to distribute by monthly […]The post Email subscription changing first appeared on John D. Cook.
The base with the largest decibel
This post is an expansion on a comment by Nathan Hannon: My favorite definition of e is “the base whose version of the decibel is the largest”. I hadn’t seen that before. Sounds interesting. What does it mean? First attempt My first thought was that the statement meant that the function b logb(x) is largest […]The post The base with the largest decibel first appeared on John D. Cook.
Relating Rényi entropy and q-log entropy
I’ve written before about Rényi entropy Hq and most recently q-log entropy Sq, two generalizations of Shannon entropy. There are simple equations relating Rényi entropy and q-log entropy if we measure both in nats: I mentioned in the post on q-log entropy that there were two possible ways it could be defined. The equation above […]The post Relating Rényi entropy and q-log entropy first appeared on John D. Cook.
Generalizing Shannon entropy with q-logs
The most common way to quantify entropy is Shannon entropy. That’s what people usually mean when they say “entropy” without further qualifications. A while back I wrote about Renyi entropy as a generalization of Shannon entropy. This time I’ll explore a different generalization called q-log entropy, a.k.a. Tsallis entropy. The definition of Shannon entropy includes […]The post Generalizing Shannon entropy with q-logs first appeared on John D. Cook.
Stumbling on an abandoned uranium mine
Last week my family and I made a tour of the five national parks in Utah. In Canyonlands National Park, my son-in-law noticed some grates at the bottom of a hill just a few feet off the road we were walking on. The area was not restricted. We walked over to investigate and found that […]The post Stumbling on an abandoned uranium mine first appeared on John D. Cook.
Decibel to log in new base
Logarithms in all bases are proportional. Specifically loga(x) = logb(x) / logb(a) for any bases a and b. One way to read this is to say that if you already know about logarithms base b, logarithms base a aren’t anything fundamentally new [1]. They’re proportional to logarithms base b, and in fact the proportionality constant […]The post Decibel to log in new base first appeared on John D. Cook.
Most popular posts this year
Here are the five most popular posts so far this year. Self-reproducing cellular automata Simple trig approximations How to mentally calculate logs Trig functions across programming languages Gell-Mann amnesia The posts above had the most page views. But just counting page views doesn’t measure what regular readers necessarily most enjoy reading. It’s heavily influenced by […]The post Most popular posts this year first appeared on John D. Cook.
Cyclic permutations and trace
The trace of a square matrix is the sum of the elements on its main diagonal. The order in which you multiply matrices matters: in general, matrix multiplication is not commutative. But the trace of a product of matrices may or may not depend on the order of multiplication. Specifically, trace doesn’t change if you […]The post Cyclic permutations and trace first appeared on John D. Cook.
Trick for 2×2 eigenvalues
3Blue1Brown has a nice new video on how to calculate the eigenvalues of 2×2 matrices. The most common way to find the eigenvalues of a 2×2 matrix A is working straight from the definition, solving det(A – λI) = 0. This is fine when you’re learning what eigenvalues are. But if you’ve already learned all […]The post Trick for 2×2 eigenvalues first appeared on John D. Cook.
Universal confidence interval
Here’s a way to find a 95% confidence interval for any parameter θ. With probability 0.95, return the real line. With probability 0.05, return the empty set. Clearly 95% of the time this procedure will return an interval that contains θ. This example shows the difference between a confidence interval and a credible interval. A […]The post Universal confidence interval first appeared on John D. Cook.
What is a polynomial?
When you leave the comfort of the real numbers, you might be mistaken about what a polynomial is. Suppose you’re looking at polynomials over some finite field. Why would you do that? Numerous practical applications, but that’s a topic for another post. You look in some reference that’s talking about polynomials and you see things […]The post What is a polynomial? first appeared on John D. Cook.
Confidence interval widths
Suppose you do N trials of something that can succeed or fail. After your experiment you want to present a point estimate and a confidence interval. Or if you’re a Bayesian, you want to present a posterior mean and a credible interval. The numerical results hardly differ, though the two interpretations differ. If you got […]The post Confidence interval widths first appeared on John D. Cook.
Multicolor reproducing cellular automata
The previous post looked at a cellular automaton introduced by Edward Fredkin. It has only two states: a cell is on or off. At each step, each cell is set to the sum of the states of the neighboring cells mod 2. So a cell is on if it had an odd number neighbors turned […]The post Multicolor reproducing cellular automata first appeared on John D. Cook.
Self-reproducing cellular automata
Edward Fredkin is best known these days for the Fredkin gate, a universal reversible circuit. I recently found out that Fredkin was one of the pioneers in cellular automata. His student Edwin Banks describes a cellular automaton introduced by Fredkin [1]. Edward Fredkin of MIT has described the following interesting cellular space. If the states […]The post Self-reproducing cellular automata first appeared on John D. Cook.
Humming St. Christopher
The other day I woke up with a song in my head I hadn’t heard in a long time, the hymn Beneath the Cross of Jesus. The name of the tune is St. Christopher. When I thought about the tune, I realized it has some fairly sophisticated harmony. My memory of the hymns I grew […]The post Humming St. Christopher first appeared on John D. Cook.
Aliquot ratio distribution
The previous post looked at repeatedly applying the function s(n) which is the sum of the divisors of n less than n. It is an open question whether the sequence s( s( s( … s(n) … ) ) ) always converges or enters a loop. In fact, it’s an open question of whether the sequence […]The post Aliquot ratio distribution first appeared on John D. Cook.
The iterated aliquot problem
Let s(n) be the sum of the proper divisors of n, the divisors less than n itself. A number n is called excessive, deficient, or perfect depending on whether s(n) – n is positive, negative, or 0 respectively, as I wrote about a few days ago. The number s(n) is called the aliquot sum of […]The post The iterated aliquot problem first appeared on John D. Cook.
Cologarithms and Entropy
The term “cologarithm” was once commonly used but now has faded from memory. Here’s a plot of the frequency of the terms cololgarithm and colog from Google’s Ngram Viewer. The cologarithm base b is the logarithm base 1/b, or equivalently, the negative of the logarithm base b. cologb x = log1/b x = -logb x […]The post Cologarithms and Entropy first appeared on John D. Cook.
Corollary of a well-known fact
When students learn about decimals, they’re told that every fraction either has a terminating decimal expansion or a repeating decimal expansion. The previous post gives a constructive proof of the converse: given a repeating fraction (in any base) it shows how to find what rational number it corresponds to. Maybe you learned this so long […]The post Corollary of a well-known fact first appeared on John D. Cook.
Repeating decimals in any base
My previous post ended with a discussion of repeating binary decimals such as 0.00110011…two = 1/5. For this post I’ll explain how calculations like that are done, how to convert a repeating decimal in any base to a fraction. First of all, we only need to consider repeating decimals of the form 0.1b, 0.01b, 0.001b, […]The post Repeating decimals in any base first appeared on John D. Cook.
Chaotic image out of regular slices
Yesterday I wrote about the bits in powers of 3. That post had a low-resolution image, which has its advantages, but here’s a higher resolution image that also has its advantages. The image looks chaotic. I say this in the colloquial sense, not in the technical sense as in period three implies chaos. I just […]The post Chaotic image out of regular slices first appeared on John D. Cook.
Evolution of random number generators
The previous post showed that the bits of prime powers look kinda chaotic. When you plot them, they form a triangular shape because the size of the numbers is growing. The numbers are growing geometrically, so their binary representations are growing linearly. Here’s the plot for powers of 5: You can crop the triangle so […]The post Evolution of random number generators first appeared on John D. Cook.
Powers of 3 in binary
I was thumbing through A New Kind of Science [1] and one of the examples that jumped out at me was looking at the bits in the binary representation of the powers of 3. I wanted to reproduce the image myself and here’s the result. Here a white square represents a 1 and a blue […]The post Powers of 3 in binary first appeared on John D. Cook.
...20212223242526272829...