Generated by All in One SEO v4.9.5.1, this is an llms.txt file, used by LLMs to index the site. # John D. Cook Applied Mathematics Consulting ## Sitemaps - [XML Sitemap](https://www.johndcook.com/blog/sitemap.xml): Contains all public & indexable URLs for this website. ## Posts - [Endless preparation](https://www.johndcook.com/blog/2010/07/05/endless-preparation/) - Quote about always preparing and never doing. - [Leading digits of primes](https://www.johndcook.com/blog/2023/06/22/leading-digits-of-primes/) - Distribution of the leading digits of prime numbers. - [Matching delimiters and chiastic patterns](https://www.johndcook.com/blog/2023/06/21/matching-delimiters-and-chiastic-patterns/) - Matching delimiters in LaTeX and more generally. Analogy to chiastic patterns in ancient literature. - [Equation of an ellipse or hyperbola through five points](https://www.johndcook.com/blog/2023/06/19/conic-through-five-points/) - Find the equation of an ellipse or hyperbola through five points. With Python code. - [Common words that have a technical meaning in math](https://www.johndcook.com/blog/2017/10/19/common-words-that-have-a-technical-meaning-in-math/) - Math often takes common words and gives them a technical meaning. This post goes over some of these terms that I use often. - [A parabola, a triangle, and a circle](https://www.johndcook.com/blog/2023/06/18/parabola-triangle-circle/) - Three tangents to a parabola form a triangle. The circumcircle of this triangle passes through the focus of the parabola. - [Computing inscribed radius and circumscribed radius](https://www.johndcook.com/blog/2023/01/09/inscribed-circumscribed/) - The law of sines gives you the radius of a circle outside a triangle, and the law of cotangents gives you the radius of a circle inside a triangle. - [Set of orbits with the same average distance to sun](https://www.johndcook.com/blog/2023/06/17/fixed-mean-distance/) - The set of possible orbits with specified mean distance distance to the sun. - [The Calculus of Finite Differences](https://www.johndcook.com/blog/2021/10/13/the-calculus-of-finite-differences/) - How to fix errors in the printing of Milne-Thompson's classic book The Calculus of Finite Differences. - [Plotting a function with a lot of local minima](https://www.johndcook.com/blog/2023/06/12/lots-of-local-minima/) - Plotting a function with a lot of local minima. Stress testing plotting software. - [Productive productivity](https://www.johndcook.com/blog/2023/06/03/productive-productivity/) - Most productivity hacks I've tried have not been productive, but a few have. - [Reviewing a thousand things](https://www.johndcook.com/blog/2023/05/30/reviewing-a-thousand-things/) - Reviewing 1,000 items by random sampling isn't very efficient. You'll probably need to draw more than 7,000 times before you see everything. - [Collecting a large number of coupons](https://www.johndcook.com/blog/2023/06/09/coupon-collector-2/) - Chernoff bounds for the coupon collector problem, estimating the probability that the time required to collect all of N things exceeds N(log N + cN). - [Intersecting spheres and GPS](https://www.johndcook.com/blog/2026/04/14/intersecting-spheres-and-gps/) - High-level discussion of how GPS works by find the intersections of spheres. - [Finding a parabola through two points with given slopes](https://www.johndcook.com/blog/2026/04/14/artz-parabola/) - The Wikipedia article on modern triangle geometry has an image labled "Artzt parabolas" with no explanation. A quick search didn't turn up anything about Artzt parabolas [1], but apparently the parabolas go through pairs of vertices with tangents parallel to the sides. The general form of a conic section is ax² + bxy + cy² - [Mathematical minimalism](https://www.johndcook.com/blog/2026/04/13/the-smallest-math-library/) - How to bootstrap all the common calculator functions from just one function. - [The gap between Eastern and Western Easter](https://www.johndcook.com/blog/2026/04/12/orthodox-western-easter/) - Why are the Eastern and Western dates of Easter different? Is Eastern Easter always later than Western Easter? How far apart can the two dates be? - [Lunar period approximations](https://www.johndcook.com/blog/2026/04/12/lunations/) - Why the length of a lunar cycle is awkward to work with, and how it contributes to the complexity of determining the date of Easter. - [Distribution of digits in fractions](https://www.johndcook.com/blog/2026/04/10/fraction-digits/) - Fractions with a prime denominator can be grouped into classes by the sets digits they cycle through. In these sets, all digits appear the same number of times. - [The Great Pyramid of Giza and the Speed of Light](https://www.johndcook.com/blog/2026/04/09/pyramid-speed-of-light/) - Coincidence between the Great Pyramid of Giza and the speed of light - [Random hexagon fractal](https://www.johndcook.com/blog/2026/04/09/random-hexagon-fractal/) - Iterative random process for creating fractals inside a hexagon - [Root prime gap](https://www.johndcook.com/blog/2026/04/08/andrica/) - Andrica's conjecture says that the square roots of consecutive primes are less than 1 apart. - [A Three- and a Four- Body Problem](https://www.johndcook.com/blog/2026/04/08/artemis-1-apollo-12/) - An example of a three-body problem, the orbit of Artemis I, and an example of a four-body problem, the orbit of Apollo 12's third stage. - [Bad takes on chaos theory](https://www.johndcook.com/blog/2024/01/27/butterflies-dont-work-that-way/) - We cannot engineer butterfly effects. But the world isn't unpredictable either. Optimistic and pessimistic fallacies. - [Toffoli gates are all you need](https://www.johndcook.com/blog/2026/04/06/tofolli-gates/) - Any Boolean function can be computed with Tofolli gates, and Tofolli gates are reversible, and so any Boolean function can be computed reversibly. - [HIPAA compliant AI](https://www.johndcook.com/blog/2026/04/05/hipaa-compliant-ai/) - The best way to run AI and remain HIPAA compliant may be to run it locally on your own hardware, not transferring PHI to the cloud. - [Kalman and Bayes average grades](https://www.johndcook.com/blog/2026/04/04/kalman-bayes/) - Updating an average as a very simple case of Bayesian inference and Kalman filters. - [Roman moon, Greek moon](https://www.johndcook.com/blog/2026/04/03/roman-moon-greek-moon/) - Names for closest and furthest approaches in the orbit of various bodies. The moon has two terms, one Greek and one Roman. - [Hyperbolic version of Napier's mnemonic](https://www.johndcook.com/blog/2026/04/02/hyperbolic-napier-mnemonic/) - Napier's mnemonic is a way to remember 10 equations in spherical trigonometry. A hyperbolic analog is very similar. - [Artemis II, Apollo 8, and Apollo 13](https://www.johndcook.com/blog/2026/04/02/artemis-apollo/) - Comparing Artemis II to the Apollo 8 and Apollo 13 missions - [TestU01 small crush test suite](https://www.johndcook.com/blog/2020/02/06/testu01-small-crush-test-suite/) - Applying SmallCrush from the TestU01 RNG test suite to data passed through an entropy extractor. Comparison to other RNG test suites. - [Using PractRand to test an RNG](https://www.johndcook.com/blog/2020/02/05/using-practrand-to-test-rng/) - Yesterday I wrote about my experience using NIST STS to test an entropy extractor, a filtering procedure that produces unbiased bits from biased sources. This post will look at testing the same entropy extractor using the Practically Random (PractRand) test suite. The results were much worse this time, which speaks to the limitations of both - [The vis-viva equation](https://www.johndcook.com/blog/2024/12/05/the-vis-viva-equation/) - The vis-viva equation greatly simplifies some calculations in orbital mechanics. It is reminiscent of how conservation of energy can sometimes trivialize what appears to be a complicated problem. In fact, the vis-viva equation is derived from conservation of energy, but the derivation is not trivial. Which is good: the effort required in the derivation implies - [Music of the spheres](https://www.johndcook.com/blog/2024/02/28/music-of-the-spheres/) - The planets orbiting the star HD 110067 have orbital frequency ratios equal to common musical frequency ratios. - [Simple trig function approximations](https://www.johndcook.com/blog/2021/03/21/simple-trig-approx/) - Simple approximations for sin, cos, and tan for angles in degrees. Could be used with the most basic calculator or even without a calculator. - [Shell variable ~-](https://www.johndcook.com/blog/2026/03/01/tilde-dash/) - After writing the previous post, I poked around in the bash shell documentation and found a handy feature I'd never seen before, the shortcut ~-. I frequently use the command cd - to return to the previous working directory, but didn't know about ~- as a shortcut for the shell variable $OLDPWD which contains the - [A lesser-known characterization of the gamma function](https://www.johndcook.com/blog/2026/03/18/wielandt/) - The Borh-Mollerup theorem is the best known characterization of the gamma function, but it's not the only one. Wielendt's theorem has different hypotheses. - [Quantum Y2K](https://www.johndcook.com/blog/2026/03/31/quantum-y2k/) - The transition to post-quantum cryptography may be a lot like preparing for Y2K. Let's hope so. - [Pentagonal numbers are truncated triangular numbers](https://www.johndcook.com/blog/2026/04/01/truncated-triangular-numbers/) - Pentagonal numbers are truncated triangular numbers. Visual and algebraic proofs. - [Morse code tree](https://www.johndcook.com/blog/2026/03/31/morse-code-tree/) - A decision tree for decoding Morse code that fits nicely on a coin. - [Computing sine and cosine of complex arguments with only real functions](https://www.johndcook.com/blog/2026/03/27/complex-argument/) - How to compute sin(x + iy) and cos(x + iy) using functions that only take a real argument. - [An AI Odyssey, Part 3: Lost Needle in the Haystack](https://www.johndcook.com/blog/2026/03/27/an-ai-odyssey-part-3-lost-needle-in-the-haystack/) - Companies are in a big rush to put AI-enabled features on their web sites. But do they work? Here we discuss a less-than-hopeful example. - [Lebesgue constants](https://www.johndcook.com/blog/2026/03/26/lebesgue-constants/) - Definition of Lebesgue constants and their application to estimating interpolation error. Asymptotics for evenly spaced and Chebyshev spaced nodes. - [How much precision can you squeeze out of a table?](https://www.johndcook.com/blog/2026/03/26/table-precision/) - When you interpolate a function from a table of values, higher order interpolation may reduce pure interpolation error while increasing numerical error. - [From Mendeleev to Fourier](https://www.johndcook.com/blog/2026/03/24/from-mendeleev-to-fourier/) - A theorem by Mendeleev, generalized by Markov, then by Bernstein, applied to Fourier series. - [Mendeleev's inequality](https://www.johndcook.com/blog/2026/03/24/mendeleevs-inequality/) - An inequality theorem discovered by Dmitri Mendeleev of periodic table fame, generalized by A. A. Markov. - [Set intersection and difference at the command line](https://www.johndcook.com/blog/2026/03/23/intersection-difference/) - Finding the intersection and difference of two lists at the command line. A couple thin wrappers around comm that make it easier to use. - [Embedded regex flags](https://www.johndcook.com/blog/2026/03/20/embedded-regex-flags/) - Embedded modifiers like (?i) put modification intensions directly in a regular expression. How this works, and doesn't work, in Python. - [Tighter bounds on alternating series remainder](https://www.johndcook.com/blog/2026/03/17/alternating-series-remainder/) - If the differences of the terms in an alternating series converge monotonically to zero, it's possible to get more informative remainder bounds. - [Converting between quaternions and rotation matrices](https://www.johndcook.com/blog/2025/05/07/quaternions-and-rotation-matrices/) - Equations and Python code for going back and forth between quaternion and matrix representations of rotations. - [Twelve-tone composition](https://www.johndcook.com/blog/2026/03/15/twelve-tone-composition/) - Twelve-tone music composition technique. Overlap of math and music. - [Powers don't clear fractions](https://www.johndcook.com/blog/2026/03/17/powers-dont-clear-fractions/) - If a number has a finite but nonzero fractional part, so do all its powers. Short proof. - [Tone row operations](https://www.johndcook.com/blog/2026/03/17/tone-row-operations/) - Are the retrograde and inverted forms of a tone row always distinct? What if you consider rotations of a tone row to be the same? - [Trig of inverse trig](https://www.johndcook.com/blog/2026/02/25/trig-of-inverse-trig/) - Table summarizing results for applying a trig function to an inverse trig function, such as sine of arctangent etc. With geometric proofs. - [Hyperbolic versions of latest posts](https://www.johndcook.com/blog/2026/02/25/hyperbolic-versions-of-latest-posts/) - Table of hyperbolic functions applied to inverse hyperbolic functions. - [How much certainty is worthwhile?](https://www.johndcook.com/blog/2026/03/08/how-much-certainty-is-worthwhile/) - The appropriate level of confirmation is an economic decision. Maybe a quick sniff test is enough. Maybe a few spot tests. Maybe full-blown formal verification. - [Trig composition table](https://www.johndcook.com/blog/2026/03/09/trig-composition-table/) - A six by six table of all trig functions applied to all their inverses. How to verify the identities. - [sinh( arccosh(x) )](https://www.johndcook.com/blog/2026/03/10/sinh-arccosh/) - When Mathematica seems to not to know how to simplify an expression, it may be doing the right thing, being more sophisticated than you expect. - [Simplifying expressions in SymPy](https://www.johndcook.com/blog/2026/03/10/simplifying-expressions-in-sympy/) - Why the simplification in SymPy doesn't work like you might expect unless you make your assumptions explicit. - [Langford series](https://www.johndcook.com/blog/2026/03/15/langford-series/) - Notice anything special about the following sequence? 8 6 10 3 1 11 1 3 6 8 12 9 7 10 4 2 5 11 2 4 7 9 5 12 Each of the numbers 1 through 12 appear twice. Between the two 1s there is one number. Between the two 2s there are two - [Inverse cosine](https://www.johndcook.com/blog/2026/03/12/arccos/) - Looking closely at the inverse cosine function defined over the complex plane. - [Typesetting sheet music with AI](https://www.johndcook.com/blog/2026/03/13/typesetting-sheet-music-with-ai/) - I asked Grok and ChatGPT to reproduce sheet music from a photo. Hilarity ensued. - [From logistic regression to AI](https://www.johndcook.com/blog/2026/03/04/from-logistic-regression-to-ai/) - It's been said that LLMs are "just" logistic regression at a large scale. How do you so from logistic regression to LLMs? What's similar, what's different? - [An AI Odyssey, Part 1: Correctness Conundrum](https://www.johndcook.com/blog/2026/03/02/an-ai-odyssey-part-1-correctness-conundrum/) - AI systems can make mistakes on critical tasks. We discuss AI system accuracy in the context of industrial standards of reliability. - [An AI Odyssey, Part 2: Prompting Peril](https://www.johndcook.com/blog/2026/03/04/an-ai-odyssey-part-2-prompting-peril/) - AI chatbots can give significantly different answers to what would seem to be the same question. Here we discuss some of the issues. - [Differential equation with a small delay](https://www.johndcook.com/blog/2026/03/02/small-delay/) - The effect of adding a small delay to a simple differential equation - [A bigger clipboard](https://www.johndcook.com/blog/2008/02/05/a-bigger-clipboard/) - Imagine you find a paragraph on the web that you want to email to a friend. You copy the paragraph. Then you think you should send a link to full article, so you copy that too. You start composing your email and you type Ctrl-V to paste in the paragraph, but to your disappointment you just paste the link. - [Simple approximation for Gamma function](https://www.johndcook.com/blog/2021/03/26/simple-gamma-approximation/) - Simple approximation for the gamma function on the interval 2, 3], which can be bootstrapped to compute any gamma function value. - [Dave Brubeck mass](https://www.johndcook.com/blog/2009/04/21/dave-brubeck-mass/) - Judging from the comments on previous posts, it seems a good number of Dave Brubeck fans read this blog. Everyone familiar with Dave Brubeck knows about Take Five from his album Time Out. But I wonder how many know about his album "To Hope! A Celebration." The album is a Roman Catholic mass containing beautiful - [Exahash, Zettahash, Yottahash](https://www.johndcook.com/blog/2026/02/22/zettahash/) - When I first heard of cryptographic hash functions, they were called "one-way functions" and seemed like a mild curiosity. I had no idea that one day the world would compute a mind-boggling number of hashes every second. Because Bitcoin mining requires computing hash functions to solve proof-of-work problems, the world currently computes around 1,000,000,000,000,000,000,000 hashes, - [Working with file extensions in bash scripts](https://www.johndcook.com/blog/2026/02/28/file-extensions-bash/) - Example of using bash shell parameter expansions. A little script that compiles a LaTeX file to an SVG file. - [A curious trig identity](https://www.johndcook.com/blog/2026/02/24/a-curious-trig-identity/) - A trig identity that doesn't look like it should be true. - [Copy and paste law](https://www.johndcook.com/blog/2026/02/23/copy-and-paste-law/) - Statistical verification of deidentification. Two California laws, one for Health & Safety and the other Insurance, have the exact same provisions. - [Giant Steps](https://www.johndcook.com/blog/2026/02/23/giant-steps/) - The chords in John Coltrane's Giant Steps are hard to improvise over, even though there are only nine distinct chords. - [Tritone substitution](https://www.johndcook.com/blog/2026/02/23/tritone-sub/) - Replacing a chord with one a tritone away barely moves the notes of the chord. It mostly turns the role of the 3rd and 7th upside down. - [Bitcoin mining difficulty](https://www.johndcook.com/blog/2026/02/22/bitcoin-mining-difficulty/) - How many hashes does the Bitcoin network calculate per block? How many would it take to mine a block if there were no competition? - [10,000,000th Fibonacci number](https://www.johndcook.com/blog/2026/02/21/f10000000/) - I've written a couple times about Fibonacci numbers and certificates. Here the certificate is auxiliary data that makes it faster to confirm that the original calculation was correct. This post puts some timing numbers to this. I calculated the 10 millionth Fibonacci number using code from this post. n = 10_000_000 F = fib_mpmath(n) This - [Computing big, certified Fibonacci numbers](https://www.johndcook.com/blog/2026/02/21/big-certified-fibonacci/) - How to efficiently compute the nth Fibonacci number for very large n and know that your calculation is correct. - [Visualizing orbital velocity](https://www.johndcook.com/blog/2026/02/16/hodograph/) - When the graph of a satellite's position is an ellipse, the graph of its velocity is a circle. This circle is the orbital hodograph. - [Max and min orbital speed](https://www.johndcook.com/blog/2025/02/28/max-min-orbital-speed/) - The ratio of maximum to minimum orbital speed as a function of eccentricity. Reasons why this is interesting. - [Race between primes of the forms 4k + 1 and 4k + 3](https://www.johndcook.com/blog/2026/02/15/chebyshev-bias/) - An odd prime divided by 4 leaves a remainder of either 1 or 3. Do more primes have remainder 1 or 3? What patterns are there? - [Wagon's algorithm in Python](https://www.johndcook.com/blog/2026/02/14/wagons-algorithm-in-python/) - Conclusion to the series of posts on Wagon's algorithm for writing a prime as a sum of squares. - [Finding a non-square mod p](https://www.johndcook.com/blog/2026/02/14/finding-a-non-square/) - Finding a number with no square root mod p. Part of a series on Stan Wagon's algorithm for finding numbers guaranteed in a theorem of Fermat. - [Finding a square root of -1 mod p](https://www.johndcook.com/blog/2026/02/14/square-root-minus-1-mod-p/) - How to find the analog of the imaginary unit when working mod p, with p = 4k + 1. - [ODE to Fisher's transform](https://www.johndcook.com/blog/2025/10/18/fishers-transform/) - How to compute a confidence interval for a correlation coefficient, and how it is connected to a differential equation. - [Expressing a prime as the sum of two squares](https://www.johndcook.com/blog/2026/02/12/pythagorean-primes/) - How to express a prime number as a sum of squares. Finding numbers whose existence is guaranteed by a theorem pf Fermat. - [Fibonacci numbers and time-space tradeoffs](https://www.johndcook.com/blog/2026/02/08/time-space-tradeoffs/) - Time-space tradeoffs are everywhere in computer science. And in distributed computing you have to consider whose time and whose space is more important. - [Aligning one matrix with another](https://www.johndcook.com/blog/2026/02/11/orthogonal-procrustes/) - The orthogonal Procrustes problem: finding an orthogonal rotation matrix that lines one matrix up with another, as close as possible. Solution and Python code. - [Computing large Fibonacci numbers](https://www.johndcook.com/blog/2026/02/08/computing-large-fibonacci-numbers/) - Computing the nth Fibonacci number for large values of n. Comparing the efficiency of direct calculation and Binet's algorithm. Ways to verify the result. - [Minimum of cosine sum](https://www.johndcook.com/blog/2026/02/07/chowla/) - Finding the maximum of a cosine series is easy. Finding the minimum is hard. Exploring the Chowla cosine conjecture regarding the minimum. - [Eigenvalue homework problems are backward](https://www.johndcook.com/blog/2026/02/06/eigenvalue-roots/) - Using polynomial roots to find eigenvalues, using eigenvalues to find eigenvalue roots. - [Fibonacci number certificates](https://www.johndcook.com/blog/2026/02/05/fibonacci-certificate/) - Illustrating the idea of problem solution certificates by providing a way to verify that a big number is a Fibonacci number. - [How to memorize the periodic table](https://www.johndcook.com/blog/2023/11/30/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 - [Has C++ jumped the shark?](https://www.johndcook.com/blog/2009/08/18/has-cpp-jumped-the-shark/) - Bjarne Stroustrup, creator of C++, wrote an article for Dr. Dobbs [link died] recently lamenting the decision to cut "concepts" from the upcoming revision of the C++ standard. His article left me with the feeling that C++ had jumped the shark. The upcoming standard has been called "C++0x" based on the assumption (or at least - [What can you learn from a phone number?](https://www.johndcook.com/blog/2023/11/17/phone-number-intel/) - Using public data to find out location information from a phone number - [How to memorize Unicode codepoints](https://www.johndcook.com/blog/2023/05/01/memorize-unicode/) - At the end of each month I write a newsletter highlighting the most popular posts of that month. When I looked back at my traffic stats to write this month's newsletter I noticed that a post I wrote last year about how to memorize the ASCII table continues to be popular. This post is a - [Pitch of a big wine bottle](https://www.johndcook.com/blog/2021/02/08/pitch-of-a-big-wine-bottle/) - When you blow across the neck of a very large and oddly shaped wine bottle, you get a pitch near what you would predict based on Helmholtz resonance. - [Finding large pseudoprimes](https://www.johndcook.com/blog/2020/01/08/finding-large-pseudoprimes/) - When you're looking for primes, you hope not to run into a pseudoprime. How would you deliberately find a pseudoprime? - [Looking in both directions](https://www.johndcook.com/blog/2013/05/13/looking-in-both-direction/) - From David Mumford's May 2013 interview in SIAM News: The applied mathematician has the difficult job of looking at a problem in context with no explicit mathematics and trying to see what kinds of mathematical ideas are under the surface that could clarify the situation. I think the most successful applied mathematicians are those who - [Using one RNG to sample another](https://www.johndcook.com/blog/2019/06/04/shrinking-generator/) - A simple idea for turning two insecure random number generators into one hopefully secure generator - [Various kinds of pseudoprimes](https://www.johndcook.com/blog/2020/01/08/euler-pseudoprimes/) - Every theorem about primes gives a necessary condition for whether a number is prime. If the theorem is not sufficient, then composite numbers may slip by. - [Cologarithms and Entropy](https://www.johndcook.com/blog/2021/04/30/cologarithm/) - The term "cologarithm" isn't used any more, but it makes the formula for entropy look more palatable at first glance. Entropy units of bits, dits, nats, etc. - [i^i^i ...](https://www.johndcook.com/blog/2021/03/10/iii/) - Plotting the sequence i, i^i, i^(i^i), ... - [Prime chains](https://www.johndcook.com/blog/2026/01/10/prime-chains/) - Primecoin is a cryptocurrency whose mining task requires finding chains of prime numbers. It's a blockchain built on prime chains. - [Stylometry](https://www.johndcook.com/blog/2026/01/20/stylometry/) - Stylometery is the statistical analysis of an author's writing style. Links to a few brief posts on stylometry and adjacent topics. - [How to prove you know a discrete logarithm](https://www.johndcook.com/blog/2026/01/23/zkp-discrete-logarithm/) - An example of a zero knowledge proof: how to prove that you know a discrete logarithm without revealing the logarithm itself. - [Γ(1/n)](https://www.johndcook.com/blog/2026/02/04/gamma-reciprocal/) - If n is a positive integer, the ceiling of the gamma function at 1/n equals n. - [Polish serenity](https://www.johndcook.com/blog/2026/02/03/polish-serenity/) - A mashup of "not my circus, not my monkeys" and the Serenity Prayer. - [Satellites have a lot of room](https://www.johndcook.com/blog/2026/02/02/satellites-have-a-lot-of-room/) - There's a lot of room in low earth orbit (LE0), about 100,000,000 cubic meters per satellite. - [Lessons Learned With the Z3 SAT/SMT Solver](https://www.johndcook.com/blog/2025/03/17/lessons-learned-with-the-z3-sat-smt-solver/) - SAT and SMT solvers have many industrial uses. Tricks of the trade for getting them to perform better can be useful. Here are a few that I have found. - [AGI, ASI, A*I - Do we have all we need to get there?](https://www.johndcook.com/blog/2026/01/30/agi-asi-ai-do-we-have-all-we-need-to-get-there/) - Many experts have different opinions whether we need "something more" to get to artificial general intelligence. Here we give a short survey. - [Bridging secrets is hard](https://www.johndcook.com/blog/2026/01/30/bridging-secrets/) - You can use crypto of you can have privacy. But if you want to use crypto AND have privacy, it's hard. Bridging tokens is easy, bridging secrets is hard. - [Proving you know a product](https://www.johndcook.com/blog/2026/01/24/proving-you-know-a-product/) - How to prove that you know ab = c without providing a, b, or c. Zero knowledge proof. Simple application of elliptic curve pairing. - [Fortunes and Geometric Means](https://www.johndcook.com/blog/2026/01/24/geometric-means/) - Examples where we naturally think in terms of geometric means. Or to put it another way, we think on a logarithmic scale without realizing it. - [What is a Pedersen commitment?](https://www.johndcook.com/blog/2025/12/06/pedersen-commitment/) - What are Pedersen commitments? How are they used? Why do they not require a trusted setup? What do they have to do with homomorphic encryption? - [Lewis Carroll and Zero Knowledge Proofs](https://www.johndcook.com/blog/2025/08/01/jubjub/) - Several elliptic curves which Zcash uses in zero knowledge proofs are named after characters from Lewis Carroll: Jubjub, Bandersnatch, Tweddledee, Tweedledum - [Zero knowledge proof of compositeness](https://www.johndcook.com/blog/2025/11/29/zkp-composite/) - Testing whether a number is composite as an example of a zero knowledge proof. How ZKPs are used more generally. - [Mills ratio and tail thickness](https://www.johndcook.com/blog/2026/01/21/mills-ratio/) - The Mills ratio highlights an important difference between a normal distribution and a t distribution with many degrees of freedom. - [Sigmas and Student](https://www.johndcook.com/blog/2026/01/21/sigmas-and-student/) - What is the probability of a six-sigma event for a Student t distribution? How does it depend on the number of degrees of freedom? - [Two cheers for ugly code](https://www.johndcook.com/blog/2026/01/19/ugly-code/) - Ugly code can be very valuable. Of course well-written code is better, all else being equal, but all else is seldom equal. - [Prime gaps and Gapcoin](https://www.johndcook.com/blog/2026/01/18/prime-gaps-gapcoin/) - The Gapcoin cryptocurrency requires miners to find prime gaps that are large relative to the logarithm of the prime. - [Prime clusters and Riecoin](https://www.johndcook.com/blog/2026/01/18/prime-clusters-riecoin/) - Finding prime clusters is computationally challenging, but solutions are easy to verify. It is used as the proof-of-work task in the Riecoin cryptocurrency. - [Efficiently testing multiple primes at once](https://www.johndcook.com/blog/2026/01/16/testing-multiple-primes/) - Testing an entire prime chain at once rather than testing the elements sequentially. - [Tighter bounds in the prime number theorem](https://www.johndcook.com/blog/2026/01/16/prime-number-theorem-bounds/) - New tighter bounds for the prime number theorem, valid for all x and not just enormous values. - [Efficiently computing multiple modular inverses at once](https://www.johndcook.com/blog/2026/01/14/montgomerys-trick/) - Montgomery's trick is an algorithm for computing multiple inverses modulo the same prime in less time than it would take to compute each inverse individually. - [Combining in-shuffles and out-shuffles](https://www.johndcook.com/blog/2026/01/12/in-out-shuffle/) - How many of the possible arrangements of a deck of 52 cards can be arrived at via a combination of perfect in-shuffles and out-shuffles? - [The middle binomial coefficient](https://www.johndcook.com/blog/2026/01/12/the-middle-binomial-coefficient/) - Estimating the size of the middle binomial coefficient. Using the central limit theorem to prove an asymptotic result. - [Primecoin primality test](https://www.johndcook.com/blog/2026/01/10/primecoin-primality-test/) - Primecoin uses a primality test that is especially suited to testing prime chains, and extension by Lifchitz of the Euler-Lagrange test. - [Bi-twin prime chains](https://www.johndcook.com/blog/2026/01/10/bi-twin-prime-chains/) - Bi-twin prime chains are a sequence of twin prime pairs where the average of each pair is twice the average of the previous pair. - [Compressing a set of hash values](https://www.johndcook.com/blog/2026/01/09/golomb-rice/) - Explaining the idea behind Golomb Coded Sets, a way to compress a set of hash values by using variable-length encoding on the differences in the sorted values. - [Varicode](https://www.johndcook.com/blog/2022/03/01/varicode/) - Varicode is a self-synchronizing, variable-length binary encoding system. - [Preprocessing text to make it more compressible](https://www.johndcook.com/blog/2024/10/15/burrows-wheeler/) - A reversible permutation of text that makes it more efficient to compress, a preprocessing step for compression algorithms. - [Naive compression of genetic data](https://www.johndcook.com/blog/2021/08/23/naive-compression-of-genetic-data/) - Simply compressing a text file containing genetic sequence data is not very efficient. You can do much better with specialized algorithms. - [Compression and interpolation](https://www.johndcook.com/blog/2024/08/17/compression-and-interpolation/) - How to bound the error in polynomial approximation. Illustration from a book on numerical methods. Applies to photos, audio clips, etc. - [Memorizing chemical element symbols](https://www.johndcook.com/blog/2026/01/07/chemical-element-symbols/) - Some heuristics for keeping chemical element symbols straight. - [Largest known compositorial prime](https://www.johndcook.com/blog/2026/01/06/largest-known-compositorial-prime/) - Newly discovered record compositorial prime - [log2(3) and log2(5)](https://www.johndcook.com/blog/2026/01/05/log2-of-3-and-5/) - Is it easier to approxiate log2 of 3 or log2 of 5 as a rational number? - [Bowie integrator and the nonlinear pendulum](https://www.johndcook.com/blog/2025/12/23/bowie-integrator-and-the-nonlinear-pendulum/) - An ODE solver better known in the space industry than in the academic literature. Illustrated on the nonlinear pendulum problem. - [In-shuffles and out-shuffles](https://www.johndcook.com/blog/2026/01/01/in-shuffle-out-shuffle/) - There are two kinds of perfect Faro shuffles: in-shuffles and out-shuffles. - [Perfect and imperfect shuffles](https://www.johndcook.com/blog/2026/01/01/perfect-shuffles/) - Shuffling a deck of cards works because ordinarily the process is imperfect. But with perfect shuffles, a deck will return to its original order. - [Adding fonts to the PowerShell and cmd.exe consoles](https://www.johndcook.com/blog/2009/07/24/windows-console-fonts/) - The default font options for the PowerShell console are limited: raster fonts and Lucida Console. Raster fonts are the default, though Lucida Console is an improvement. In my opinion, Consolas is even better, but it's not on the list of options. Mastering PowerShell by Tobias Weltner explains how to expand the list of font options - [Perlis on complexity](https://www.johndcook.com/blog/2008/03/29/perlis-on-complexity/) - From Alan Perlis: Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it. See this site for a list of other epigrams from Perlis. [link rotted] - [Reverse engineering Fourier conventions](https://www.johndcook.com/blog/2022/03/20/reverse-engineering-fourier-conventions/) - Determining which Fourier conventions a resource is using from the statement of the basic theorems. - [Twin stars and twin primes](https://www.johndcook.com/blog/2023/08/14/twin-stars-and-twin-primes/) - Are there more twin stars or twin primes? What can we conclude without proving the twin prime conjecture? - [How much is a gigawatt?](https://www.johndcook.com/blog/2025/11/07/how-much-is-a-gigawatt/) - How to wrap your head around how much power a gigawatt is, and how much energy a gigawatt-year is. - [Swish, mish, and serf](https://www.johndcook.com/blog/2023/08/06/swish-mish-and-serf/) - Defining the softplus, sigmoid, swish, mish, and serf functions. The recently introduced swish, mish, and surf activation functions have advantages in deep nets - [Nonlinear algebra](https://www.johndcook.com/blog/2023/10/23/nonlinear-algebra/) - What does "nonlinear algebra" mean? In the last few years the term has come to mean an applied and computational approach to solving systems of polynomial equations. - [Two-sample t-test and robustness](https://www.johndcook.com/blog/2018/05/11/two-sample-t-test/) - The t-test assumes data come from a normal distribution. It works well even if the data are not normal, as long as they come from a symmetric distribution. - [Third order ordinary differential equations](https://www.johndcook.com/blog/2023/01/13/third-order-odes/) - Third order differential equations come up in application, but they're usually PDEs and usually nonlinear. A couple examples of linear 3rd order ODEs. - [Lewis & Clark geolocation](https://www.johndcook.com/blog/2025/12/01/lewis-clark-geolocation/) - How were the astronomical observations of Lewis and Clark turned into geographical coordinates? - [Line of position (LOP)](https://www.johndcook.com/blog/2025/12/04/line-of-position/) - The line of position is a fundamental concept in celestial navigation, the circle of positions from which a star appears at the same altitude. - [Regular expressions that cross lines](https://www.johndcook.com/blog/2025/12/19/regular-expressions-that-cross-lines/) - How to search for a regular expression pattern that may extend across a line break. - [Mason, Dixon, and Latitude](https://www.johndcook.com/blog/2025/12/23/mason-dixon-latitude/) - English surveyors Charles Mason and Jeremiah Dixon, best known for the Mason-Dixon line they established, were the first to measure a degree of longitude. - [Interesting categories are big](https://www.johndcook.com/blog/2025/12/28/interesting-categories-are-big/) - You can most ignore matters of cardinality when using category theory, and yet there is a theorem that says category theory would be trivial without such issues. - [The center of the earth is not straight down](https://www.johndcook.com/blog/2025/12/29/geographic-vs-geocentric-latitude/) - What's the difference between geographic and geocentric latitude? How to convert between them. - [A knight's random walk](https://www.johndcook.com/blog/2012/05/08/a-knights-random-walk/) - Here's a puzzle I ran across today: Start a knight at a corner square of an otherwise-empty chessboard. Move the knight at random by choosing uniformly from the legal knight-moves at each step. What is the mean number of moves until the knight returns to the starting square? There's a slick mathematical solution that I - [A deck of cards](https://www.johndcook.com/blog/2024/04/30/a-deck-of-cards/) - The standard deck of 52 playing cards is not entirely standard. It's ubiquitous in English speaking countries but not necessarily elsewhere. - [Knight's tour with fewest obtuse angles](https://www.johndcook.com/blog/2025/12/31/knights-tour-minimum-obtuse/) - A knight's tour with the minimum number of obtuse angles. From Donald Knuth's Christmas Lecture 2025. - [Monero subaddresses](https://www.johndcook.com/blog/2025/11/28/monero-subaddresses/) - Monero subaddresses are analogous to heirarchical addresses in Bitcoin wallets. How subaddresses are generated and used. - [Klein bottle](https://www.johndcook.com/blog/2025/12/27/klein-bottle/) - How to think of a Klein bottle intuitively and rigorously. - [When was Newton born?](https://www.johndcook.com/blog/2025/12/23/when-was-newton-born/) - When Sir Isaac Newton was born, England was still using the Julian calendar. He was born on Christmas by the Julian calendar, two weeks after winter solstice. - [Automation and Validation](https://www.johndcook.com/blog/2025/12/24/automation-and-validation/) - It's OK if AI is an oracle that is wrong part of the time if it's possible to know when it's wrong. Consistency checks, certificates, and formal proofs. - [Trying to fit exponential data](https://www.johndcook.com/blog/2025/12/22/fit-exponential-data/) - When you're fitting an exponential model to data, you may have the wrong model. Even if you have the right model, your uncertainty grows exponentially with time. - [Trying to fit a logistic curve](https://www.johndcook.com/blog/2025/12/20/fit-logistic-curve/) - Predicting the shape of a logistic curve from data at the beginning of the curve is a fool's errand. - [What is an elliptic curve?](https://www.johndcook.com/blog/2019/02/21/what-is-an-elliptic-curve/) - The informal definition of an elliptic curve is simple. The formal definition is more involved. - [Multiples with no large digits](https://www.johndcook.com/blog/2025/12/16/multiples-with-no-large-digits/) - Take an integer N which is not a multiple of 10. Then there is some multiple of N which only contains the digits 1, 2, 3, 4, and 5. - [Golden iteration](https://www.johndcook.com/blog/2025/12/12/golden-iteration/) - The iteration replacing x with sqrt(1 + x) converges to the ratio. The distance from the iterates to golden ratio is cut by about 1/3 at each step. - [Just change the key](https://www.johndcook.com/blog/2025/12/11/just-change-the-key/) - Changing a problem to one you can solve, illustrated with music. - [Weak derivatives](https://www.johndcook.com/blog/2025/12/10/weak-derivatives/) - There are numerous memes floating around with the words "Being weak is nothing to be ashamed of; staying weak is." Or some variation. I thought about this meme in the context of weak derivatives. The last couple posts have talked about distributions, also called generalized functions. The delta function, for example, is not actually a - [Rolling n-sided dice to get at least n](https://www.johndcook.com/blog/2025/12/10/rolling-dice/) - Say you have a common 6-sided die and need to roll it until the sum of your rolls is at least 6. How many times would you need to roll? If you had a 20-sided die and you need to roll for a sum of at least 20, would that take more rolls or fewer - [Fourier transform of a Fourier series](https://www.johndcook.com/blog/2025/12/08/fourier-transform-series/) - The previous post showed how we can take the Fourier transform of functions that don't have a Fourier transform in the classical sense. The classical definition of the Fourier transform of a function f requires the integral of |f| over the real line to be finite. This implies f(x) must approach zero as x goes - [Fourier transform of a flat line](https://www.johndcook.com/blog/2025/12/08/fourier-transform-dc/) - What is the Fourier transform of a constant function? What does it even mean? Two hand-wavy derivations and a rigorous formulation. - [Obscuring P2P nodes with Dandelion](https://www.johndcook.com/blog/2025/12/08/dandelion/) - What is the Dandelion network protocol? What is the analogy with a dandelion plant? - [Fixed points of the Fourier transform](https://www.johndcook.com/blog/2023/03/17/fixed-points-of-fourier/) - Functions that remain the same under the Fourier transform. - [The Navigational Triangle](https://www.johndcook.com/blog/2025/12/04/the-navigational-triangle/) - The navigational triangle has one vertex at your position, one at the North Pole, and one at the geographic position of a star. Solving this spherical triangle. - [Solving spherical triangles](https://www.johndcook.com/blog/2025/12/04/solving-spherical-triangles/) - Solving spherical trinagles. When is a combination of sides and angles enough to uniquely specify a solution and when are there two solutions? - [Tracking and the Euler rotation theorem](https://www.johndcook.com/blog/2023/08/17/tracking-euler/) - The composition of coordinate frame rotations can be expressed as a single rotation. How to find that rotation. - [Dutton's Navigation and Piloting](https://www.johndcook.com/blog/2023/03/07/duttons/) - Recognizing a book in the background of a scene from Hunt for Red October - [Trading education systems with China](https://www.johndcook.com/blog/2010/07/14/trading-education-systems-with-china/) - American creativity is declining according to a recent Newsweek article. The article says that America is embracing rote learning just as China is embracing creativity. In China there has been widespread education reform to extinguish the drill-and-kill teaching style. … When faculty of a major Chinese university asked [Jonathan] Plucker to identify trends in American - [Logarithms, music, and arsenic](https://www.johndcook.com/blog/2008/08/06/logarithms-music-and-arsenic/) - In some contexts, our natural sense of numbers operates on a logarithmic scale rather than a linear scale. - [God is in the details](https://www.johndcook.com/blog/2008/03/30/god-is-in-the-details/) - Some say "The devil is in the details," meaning solutions break down when you examine them closely enough. Some say "God is in the details," meaning opportunities for discovery and creativity come from digging into the details. Both are true, but the latter is more interesting. I posted something along these lines a few weeks - [Regular solids and Monte Carlo integration](https://www.johndcook.com/blog/2023/09/29/platonic-solids-and-integration/) - Using regular solids to decrease the variance in Monte Carlo integration. - [Why and how Bitcoin uses Merkle trees](https://www.johndcook.com/blog/2025/10/28/bitcoin-merkle-trees/) - What is a Merkle tree? Why and how does Bitcoin use Merkle trees? - [RSA as a pairing](https://www.johndcook.com/blog/2025/11/18/rsa-as-a-pairing/) - How RSA public key cryptography can be seen as a simple special case of pairing-based cryptography. - [True growth rate accounting for inflation](https://www.johndcook.com/blog/2025/10/06/true-growth-rate/) - With periodic compounding, the true growth rate of an investment after accounting for inflation is less than you might reasonably expect. - [Turning trig identities into Fibonacci identities](https://www.johndcook.com/blog/2025/10/17/trig-fibonacci/) - A recipe that turns trig identities into Fibonacci identities. In some sense Fibonacci numbers are like sines and Lucas numbers are like cosines. - [Testing Rupert Miller's suspicion](https://www.johndcook.com/blog/2019/09/18/kstest-shapiro/) - Rupert Miller said he suspected the K-S test was more sensitive in the middle than in the tails. We test is suspicion with simulation. - [Differential equation on a doughnut](https://www.johndcook.com/blog/2025/10/08/diffeq-donut/) - A system of three first-order differential equations whose solutions live on a torus (doughnut). - [How to make a Smith chart](https://www.johndcook.com/blog/2025/10/23/smith-chart/) - Deriving the basic mathematical properties of the Smith chart from electrical engineering - [Text case changes the size of QR codes](https://www.johndcook.com/blog/2025/10/31/smaller-qr-codes/) - Changing the case of text can change the size of the corresponding QR code. This is one of the reasons Bitcoin moved from Base58 to bech32 encoding. - [Weighting an average to minimize variance](https://www.johndcook.com/blog/2025/11/12/minimum-variance/) - How would you allocate money to a set of independent assets with to minimize volatility if some assets are more volatile than others? - [Elementary symmetric polynomials and optimization](https://www.johndcook.com/blog/2025/11/12/elementary-symmetric-polynomials/) - Definition and examples of elementary symmetric polynomials. Application to an optimization problem. - [Elliptic curve pairings in cryptography](https://www.johndcook.com/blog/2025/11/16/elliptic-curve-pairings/) - Introduction to elliptic curve pairings used in cryptography. Two examples from Ethereum and Zcash. - [Equal things that don't look equal](https://www.johndcook.com/blog/2025/11/27/hyperbolic-metric-formulas/) - There are a surprising number of expressions for the hyperbolic metric, specifically the Poincare half plane, and none of them look equivalent. - [Closest harmonic number to an integer](https://www.johndcook.com/blog/2025/11/19/closest-harmonic-number-to-an-integer/) - Given a number x, efficiently calculate n such that the nth harmonic number is the closest harmonic number to x. - [A triangle whose interior angles sum to zero](https://www.johndcook.com/blog/2025/11/28/tricusp-triangle/) - In hyperbolic geometry, the sum of a the interior angles of a triangle can be any value less than π. If the sum is zero the triangle has area π. - [A circle in the hyperbolic plane](https://www.johndcook.com/blog/2025/11/28/hyperbolic-circle/) - If you draw a circle using the hyperbolic metric, then look at the curve from a Euclidean perspective, it's still a circle, but the radius and center change. - [Hyperbolic metric](https://www.johndcook.com/blog/2025/11/26/hyperbolic-metric/) - The cross ratio can be used to define a metric on the upper half plane or disk model of the hyperbolic plane. Mobius transformations are isometries. - [How stealth addresses work in Monero](https://www.johndcook.com/blog/2025/11/24/monero-stealth-addresses/) - Monero has used stealth addresses form the beginning. Bitcoin silent addresses are very similar but still experimental. - [TV tuned to a dead channel](https://www.johndcook.com/blog/2025/11/24/tv-tuned-to-a-dead-channel/) - Prescient science fiction might not be enjoyable to read. Comments from William Gibson. - [Silent Payments](https://www.johndcook.com/blog/2025/09/25/silent-payments/) - Bitcoin transactions appear to be private because names are not attached to accounts. But that is not sufficient to ensure privacy; if it were, much of my work in data privacy would be unnecessary. It's quite possible to identify people in data that does not contain any direct identifiers. I hesitate to use the term - [Groups of semiprime order](https://www.johndcook.com/blog/2018/10/03/cyclic-groups-of-composite-order/) - 15 is the smallest composite number such that there is only one group of that order. This post gives a complete classification of such groups. - [Solving H_n = 100](https://www.johndcook.com/blog/2025/11/20/solving-h_n-100/) - Finding the value of n such that the nth harmonic number is closest to 100. - [Weddle integration rule](https://www.johndcook.com/blog/2025/11/20/weddle-integration-rule/) - Weddle's integration rule. Example application in Python. - [Quadrature rules and an impossibility theorem](https://www.johndcook.com/blog/2023/08/25/quadrature-impossibility/) - Most quadrature rules over a finite interval are "simplex" rules. Several examples given. There are no simplex rules over an infinite interval. - [Closest consecutive reciprocal sum to an integer](https://www.johndcook.com/blog/2025/11/19/closest-consecutive-reciprocal-sum-to-an-integer/) - The sum of the reciprocals of consecutive numbers cannot be an integer. How close can it get to an integer? - [Ethereum's consensus layer elliptic curve](https://www.johndcook.com/blog/2025/10/13/ethereum-bls12-381/) - Introduction to the BLS12-381 curve used in Ethereum's consensus layer. Focus on concrete calculations to make the curve more tangible. - [Pallas, Vesta, and Zcash](https://www.johndcook.com/blog/2025/08/02/pallas-vesta-zcash/) - Two elliptic curves used in Zcash for zero-knowledge proofs, one named after a Greek goddess of war and one after a Roman goddess of home and hearth - [Pairing-unfriendly curves](https://www.johndcook.com/blog/2025/08/04/pairing-unfriendly-curves/) - Although the elliptic curves Tweedledum and Tweedledee are used together, and the curves Pallas and Vesta are used together, none are pairing-friendly curves. - [Pythagorean triples](https://www.johndcook.com/blog/2025/11/18/pythagorean-triples-2/) - Five posts on Pythagorean triangles and Pythagorean triples - [Three-party Diffie-Hellman in one shot](https://www.johndcook.com/blog/2025/11/17/three-party-diffie-hellman/) - The simple way to extend Diffie-Hellman key exchange to 3 parties requires 2 rounds of message passing. Elliiptic curve pairings let you reduce this to 1 round. - [Adding an imaginary unit to a finite field](https://www.johndcook.com/blog/2025/11/16/finite-field-i/) - Forming a finite field of order p^2 by adding an imaginary unit. Example from Ethereum implementation. - [Four generalizations of the Pythagorean theorem](https://www.johndcook.com/blog/2025/11/13/pythagorean-generalizations/) - Four generalizations of the Pythagorean theorem. General plane triangle theorems by Apollonius and Dijkstra. Extension to tetrahedra & to non-Euclidean geometry - [Brownian motion and Riemann zeta](https://www.johndcook.com/blog/2025/11/10/brownian-zeta/) - Excellent video by Almost Sure: What does Riemann Zeta have to do with Brownian Motion? - [Japanese polygon theorem](https://www.johndcook.com/blog/2025/11/05/japanese-polygon-theorem/) - The Japanese cyclic polygon theorem. An interesting theorem with pretty illustrations. Python code to create the illustrations. - [Rolling correlation](https://www.johndcook.com/blog/2025/11/09/rolling-correlation/) - Apparent periodic correlation between two random walks is entirely an artifact of the way the rolling correlation is calculated. - [Analog of Heron's formula on a sphere](https://www.johndcook.com/blog/2025/11/08/heron-on-a-sphere/) - Spherical analog of Heron's formula. Compute the area of a spherical triangle from the lengths of its sides. - [Tetrahedral analog of the Pythagorean theorem](https://www.johndcook.com/blog/2025/11/03/de-gua/) - A Pythagorean-like theorem for tetrahedra, and its generalization to higher dimensions. Illustrated with Python code. - [The anti-Smith chart](https://www.johndcook.com/blog/2025/11/02/anti-smith-chart/) - The Smith chart is the image of a grid in the right half-plane under a fractional linear msp. What would the image of a grid in the LEFT half-plane look like? - [Twelve Days of Christmas and tetrahedral numbers](https://www.johndcook.com/blog/2009/12/08/tetrahedral-numbers/) - How many gifts are there in the song Twelve Days of Christmas? Day 1: 1 gift Day 2: 1 + 2 = 3 gifts Day 3: 1 + 2 + 3 = 6 gifts … Day 12: 1 + 2 + 3 + … + 12 = 78 gifts The number of gifts on day - [Impedance and Triangular Numbers](https://www.johndcook.com/blog/2025/11/02/impedance-and-trianglular-numbers/) - A few days ago I wrote two posts about how to create a Smith chart, a graphical device used for impedance calculations. Then someone emailed me to point out the connection between the Smith chart and triangular numbers. The Smith chart is the image of a rectangular grid in the right half-plane under the function - [Cross ratio](https://www.johndcook.com/blog/2025/11/01/cross-ratio/) - The cross ratio is an ancient concept in geometry. How the cross ratio in geometry relates to the cross ratio in complex analysis. - [Continued fractions as matrix products](https://www.johndcook.com/blog/2023/09/22/continued-fractions-as-matrix-products-2/) - Continued fractions are the composition of simple fractions, and so they correspond to the product of the matrices associated with the simple fractions. - [Bech32 encoding](https://www.johndcook.com/blog/2025/09/09/bech32-encoding/) - What is Bech32 encoding? Where does the name come from? What are its advantages? - [An ancient generalization of the Pythagorean theorem](https://www.johndcook.com/blog/2025/10/30/apollonius-theorem/) - A theorem by Apollonius of Perga (262 BC – 190 BC) that is analogous to the Pythagorean theorem but applies to general triangles, not just right triangles. - [Blog changes coming](https://www.johndcook.com/blog/2014/11/01/blog-changes-coming/) - I'm in the process of redesigning my blog and website. Some things will move around, but nothing is going away. In particular, the URL https://www.johndcook.com/blog may take you to the new home page rather than the latest blog post, at least temporarily. If you subscribe via RSS posts will come to you as usual; you shouldn't - [Monitoring legacy code that fails silently](https://www.johndcook.com/blog/2008/06/24/monitoring-legacy-code-that-fails-silently/) - Clift Norris and I just posted an article on CodeProject entitled Monitoring Unreliable Scheduled Tasks about some software Clift wrote to resolve problems we had calling some legacy software that would fail silently. His software adds from the outside monitoring and logging functions that better software would have provided on the inside. The monitoring and logging - [Singularity interview](https://www.johndcook.com/blog/2011/03/01/singularity-interview/) - Vincent Tan interviews me in the March 2011 issue of his online magazine Singularity. One of the topics we discuss is the difference between studying applied math and actually applying math. - [Random number generator controversy](https://www.johndcook.com/blog/2008/04/12/random-number-generator-controversy/) - Common questions regarding random number generation - [How to calculate percentiles in memory-bound applications](https://www.johndcook.com/blog/2008/04/28/how-to-calculate-percentiles-in-memory-bound-applications/) - I just published a new article on CodeProject: Calculating percentiles in memory-bound applications. Finding the percentiles of a list of samples is trivial if you can read all the samples into memory and sort the list. If the list is too big to fit into memory, it's still not terribly difficult, but there are a couple - [Simple interpolation](https://www.johndcook.com/blog/2008/09/11/simple-interpolation/) - CodeProject just posted my article Filling in the gaps: simple interpolation. - [Periodic table of Typefaces](https://www.johndcook.com/blog/2009/03/12/periodic-table-of-typefaces/) - Squidspot.com has created an interesting period table of typefaces. Related post: Periodic table of Perl operators - [Overflow and loss of precision](https://www.johndcook.com/blog/2008/04/16/overflow-and-loss-of-precision/) - Techniques and examples for avoiding overflow and loss of precision in floating point programming. - [Where to wait for an elevator](https://www.johndcook.com/blog/2010/11/29/where-to-wait-for-an-elevator/) - Where do you stand in order to minimize the expected distance to walk to catch the first elevator that arrives? Maybe not where you think. - [Technological context](https://www.johndcook.com/blog/2018/10/03/technological-context/) - It's now possible to use computers without being as aware of technological context. But sometimes this causes inexplicable problems. - [Blog email subscription](https://www.johndcook.com/blog/2021/06/08/blog-email-subscription/) - You can still subscribe to my blog via email, but the provider is changing from Feedburner to MailerLite. - [Remove algorithmic filters from what you read](https://www.johndcook.com/blog/2023/01/26/unfiltered/) - Choose for yourself what you read by subscribing to what you want to keep up with, via email or even better via RSS. - [Ways to connect](https://www.johndcook.com/blog/2018/02/15/ways-to-connect/) - Various ways to connect with me: Twitter, RSS, email, phone, etc. - [The Nickel Tour](https://www.johndcook.com/blog/2015/06/23/welcome/) - A short guided tour of my web site for new visitors. Some things I've written, how to subscribe, where to find me, etc. - [How to subscribe](https://www.johndcook.com/blog/2022/01/26/how-to-subscribe/) - How to subscribe to my blog via email or RSS. - [How blocks are chained in a blockchain](https://www.johndcook.com/blog/2025/10/27/blockchain/) - How blocks in the Bitcoin blockchain are chained together. Looking at an example at the the byte level to get the real story, past the oversimplifications. - [Mentally compute logs base 2](https://www.johndcook.com/blog/2025/10/29/estimating-log-base-2/) - An approximation for logarithms base 2 that is simple enough to evaluate mentally. How the formula may have been discovered. - [Physical Keys and Encryption Keys](https://www.johndcook.com/blog/2025/10/29/physical-keys-encryption-keys/) - How many notches would a physical key need to have in order to have security comparable to an AES encryption key? - [Freshman's dream](https://www.johndcook.com/blog/2025/10/28/freshmans-dream/) - The Freshman's dream is an equation that in general is a naive mistake, but is true and useful in some contexts. - [987654321 / 123456789](https://www.johndcook.com/blog/2025/10/26/987654321/) - The ratio 987654321 / 123456789 is very nearly 8. What about the analogous ratio in other bases? - [Sharing secrets using polynomials](https://www.johndcook.com/blog/2019/02/28/secret-sharing/) - How to use polynomials to share secrets, and how to verify that the secret has been shared without unlocking it. - [Spacing the circles on the Smith chart](https://www.johndcook.com/blog/2025/10/25/smith-chart-spacing/) - The previous post looked at the basics of how to create a Smith chart. The Smith chart is the image of a Cartesian grid in the right half-plane under the function f(z) = (z − 1)/(z + 1). At the end of the post I noted that evenly distributed grid lines in the z plane result in very - [Generating random points in Colorado](https://www.johndcook.com/blog/2025/10/22/generating-random-points-in-colorado/) - Comparing two ways of generating random points on a sphere by showing that they both generate points in Colorado with the same probability. - [Random spherical coordinates](https://www.johndcook.com/blog/2025/10/22/random-spherical-coordinates/) - How to generate random points on a sphere in spherical coordinates (ρ, θ, ϕ). Direct method, not generating Cartesian coordinates first. - [Distribution of coordinates on a sphere](https://www.johndcook.com/blog/2025/10/18/coordinates-on-sphere/) - Demonstrating the the coordinates of uniformly distributed points on a sphere are uniform, uncorrelated, but dependent. - [Distribution of correlation](https://www.johndcook.com/blog/2025/10/20/distribution-of-correlation/) - Demonstrating the distribution of the correlation coefficient with simulation. How the skewness of the distribution relates to correlation. - [Quality metrics](https://www.johndcook.com/blog/2025/10/18/quality-metrics/) - Update on converting between nines and sigmas as quality measures. - [Experiences with GPT-5-Codex](https://www.johndcook.com/blog/2025/10/16/experiences-with-gpt-5-codex/) - The new GPT-5-Codex model is a powerful coding assistant. Here we share some initial impressions. - [Zcash price doubled](https://www.johndcook.com/blog/2025/10/08/zcash-price-doubled/) - The price of the privacy coin Zcash doubled over the course of one week. Why might that be? Are more people using Zcash? - [Inverting matrices and bilinear functions](https://www.johndcook.com/blog/2025/10/12/invert-mobius/) - The analogy between Möbius transformations (bilinear functions) and 2 by 2 matrices is more than an analogy. Stated carefully, it's an isomorphism. - [Generate random points inside a sphere](https://www.johndcook.com/blog/2025/10/11/ball-rng/) - Generating random points inside a sphere of any dimension. - [Random samples from a tetrahedron](https://www.johndcook.com/blog/2025/10/11/random-samples-from-a-tetrahedron/) - How to generate uniform random samples from inside a tetrahedron. How to illustrate that the sampling works as intended. - [GPT-5 for AI-assisted discovery](https://www.johndcook.com/blog/2025/10/10/gpt-5-for-ai-assisted-discovery/) - Claims and counterclaims have been made about what AI models can actually do regarding scientific discovery. We look at examples of what is possible now. - [More on Carmichael](https://www.johndcook.com/blog/2025/10/09/more-on-carmichael/) - A few notes on Euler's totient function and Carmichael's totient function. - [RSA with multiple primes](https://www.johndcook.com/blog/2025/10/07/rsa-with-multiple-primes/) - RSA public keys are usually the product of two primes, but they could be the product of multiple primes, and sometimes they are for digital signatures. - [A quiet change to RSA](https://www.johndcook.com/blog/2025/10/06/a-quiet-change-to-rsa/) - Over the course of years, RSA implementations gradually replaced Euler's totient function with Carmichael's totient function. - [Fermat primes and tangent numbers](https://www.johndcook.com/blog/2025/10/05/fermat-primes-tangent/) - The nth Fermat number is prime if and only if it does not divide the (F(n) − 2)th tangent number. - [Memorizing a list of seed words](https://www.johndcook.com/blog/2025/10/05/memorizing-a-list-of-seed-words/) - Applying memory system techniques to memorizing a crypto wallet list of seed words - [10x vs 10%](https://www.johndcook.com/blog/2025/10/03/10x-vs-10-percent/) - Being 10x better at some things would make no difference. Being 10% better at other things could make a big difference. - [Big Logic](https://www.johndcook.com/blog/2016/08/30/big-logic/) - New complexity requires new tools to manage. - [Thermocouple polynomials and other sundries](https://www.johndcook.com/blog/2019/03/18/thermocouple-polynomials/) - I was looking up something on the NIST (National Institute of Standards and Technology) website the other day and ran across thermocouple polynomials. I wondered what that could be, assuming "thermocouple" was a metaphor for some algebraic property. No, it refers to physical thermocouples. The polynomials are functions for computing voltage as a function of - [Boundary conditions are the hard part](https://www.johndcook.com/blog/2012/01/24/boundary-conditions/) - What we call "differential equations" are usually not just differential equations. They also have associated initial conditions or boundary conditions. With ordinary differential equations (ODEs), the initial conditions are often an afterthought. First you find a full set of solutions, then you plug in initial conditions to get a specific solution. Partial differential equations (PDEs) - [Infinite is easier than big](https://www.johndcook.com/blog/2010/09/09/infinite-is-easier-than-big/) - Here are two common but unhelpful was to think about infinity. Infinity makes things harder. Infinity is a useless academic abstraction. Neither of these is necessarily true. Problems are often formulated in terms of infinity to make things easier and to solve realistic problems. Infinity is usually a simplification. Think of infinity as "so big - [Twitter account for differential equations](https://www.johndcook.com/blog/2013/03/13/twitter-account-for-differential-equations/) - I've started a new Twitter account: @diff_eq. This account posts once or twice a day about ordinary and partial differential equations. More daily tip accounts here. - [Emacs](https://www.johndcook.com/blog/2010/03/16/emacs/) - Some thoughts on Emacs, written just before I decided to give Emacs another try. Now I use Emacs regularly. - [What good is an old weather forecast?](https://www.johndcook.com/blog/2014/02/06/what-good-is-an-old-weather-forecast/) - Why would anyone care about what the weather was predicted to be once you know what the weather actually was? Because people make decisions based in part on weather predictions, not just weather. Eric Floehr of ForecastWatch told me that people are starting to realize this and are increasingly interested in his historical prediction data. - [Programs and Proofs](https://www.johndcook.com/blog/2008/01/10/complementary-validation/) - Programs have errors, but so do proofs. When a program and a proof agree, they increase your confidence in both. - [The excitement of not knowing what you’re doing](https://www.johndcook.com/blog/2008/01/23/the-excitement-of-not-knowing-what-youre-doing/) - Dijkstra quote about how programmer like "the intellectual excitement of not quite understanding what they were doing." - [Taking away a damaging tool](https://www.johndcook.com/blog/2015/09/24/taking-away-a-damaging-tool/) - This is a post about letting go of something you think you need. It starts with an illustration from programming, but it's not about programming. Bob Martin published a dialog yesterday about the origin of structured programming, the idea that programs should not be written with goto statements but should use less powerful, more specialized - [Simple derivation of exponential approximation](https://www.johndcook.com/blog/2021/07/24/bilinear-exp-approximation/) - There's a simple way to arrive at a bilinear approximation for the exponential function. How much better is this than linear approximation? Why? - [You can be a hero with a simple idea](https://www.johndcook.com/blog/2010/12/03/you-can-be-a-hero-with-a-simple-idea/) - Yesterday I mentioned someone who published a scholarly paper in 1994 for a technique commonly taught in freshman calculus. There's been a lot of discussion of this (the paper, not my blog post) on the web. The general take has been that this was an egregious failure in the peer review system. No one recognized - [Maybe you don't need to](https://www.johndcook.com/blog/2012/11/01/maybe-you-dont-need-to/) - One life-lesson from math is that sometimes you can solve a problem without doing what the problem at first seems to require. I'll give an elementary example and a more advanced example. The first example is finding remainders. What is the remainder when 5,000,070,004 is divided by 9? At first it may seem that you - [What's good for you in red wine](https://www.johndcook.com/blog/2008/10/08/whats-good-for-you-in-red-wine/) - I've heard two podcasts that contradict each other somewhat as far as what it is in red wine that's good for you. According to this Scientific American interview with Charles Bamforth it's really the alcohol in wine that's good for your arteries and so you might as well drink beer, and that in fact beer has some health - [Rate of regularizing English verbs](https://www.johndcook.com/blog/2008/11/01/rate-of-regularizing-english-verbs/) - The half-life of an irregular verb appears to be inversely proportional to the square root of its frequency. - [Down's syndrome and cancer](https://www.johndcook.com/blog/2009/05/23/downs-syndrome-and-cancer/) - The most recent Nature podcast (21 May 2009) has a news story about Down's syndrome and cancer. Most types of cancer are much less common among people with Down's syndrome. Since Down's syndrome is caused by an extra copy of chromosome 21, researchers naturally want to know whether a gene on that chromosome is responsible - [Killing too much of a tumor](https://www.johndcook.com/blog/2009/05/30/killing-too-much-of-a-tumor/) - The traditional approach to cancer treatment has been to try to eradicate tumors. Eliminating a tumor is better than shrinking a tumor, so this approach makes sense. But if you try to eradicate the tumor and fail, you may leave the patient worse off. If you kill 90% of a tumor with some treatment but - [Buggy code is biased code](https://www.johndcook.com/blog/2010/10/19/buggy-simulation-code-is-biased/) - Buggy simulation code is biased code because you're more likely to discover bugs that contradict your expectations than bugs that confirm your expectations. - [NASA did not find arsenic-based life](https://www.johndcook.com/blog/2010/12/02/nasa-arsensic-based-file/) - Headlines are saying today that NASA found microbes that use arsenic the way all other known life uses phosphorous. The NASA website says NASA-Funded Research Discovers Life Built With Toxic Chemical [link went away]. Some other headlines include "NASA finds 'alien life' made of arsenic," "NASA finds arsenic-based life," and "NASA finds arsenic-loving bacterium." These - [Drug discovery rates](https://www.johndcook.com/blog/2014/12/31/drug-discovery-rates/) - From Zero to One: Eroom's law — that's Moore's law backward — observes that the number of new drugs approved per billion dollars spent on R&D has halved every nine years since 1950. Update: Here's an article from Nature that gives more details. The trend is pretty flat on a log scale, i.e. exponentially declining - [Contradictory news regarding ABC conjecture](https://www.johndcook.com/blog/2016/08/02/23154/) - Mochizuki’s proof of the abc conjecture is so poorly understood, experts can't agree on how poorly understood it is. - [Random inequalities II: analytical results](https://www.johndcook.com/blog/2008/07/26/random-inequalities-ii-analytical-results/) - Sometimes probability inequalities can be computed in closed form. This post gives some examples. - [Random inequalities V: beta distributions](https://www.johndcook.com/blog/2008/08/21/random-inequalities-v-beta-distributions/) - Beta random variable inequalities are important because they come up often in application. Closed-form results, when they exist, speed up calculations. - [Web 2.0 over dial-up](https://www.johndcook.com/blog/2008/11/28/web-20-over-dial-up/) - I'm borrowing an old Pentium III computer with a dial-up Internet connection. I haven't used dial up in a long time and was surprised what a difference bandwidth makes. Many "Web 2.0" sites are just painful to use. Some simply do not work. One site gave me a message essentially saying to go away and - [Fast way to test whether a number is a square](https://www.johndcook.com/blog/2008/11/17/fast-way-to-test-whether-a-number-is-a-square/) - A question came up on StackOverflow today regarding testing whether integers were perfect squares. The person asking the question said his first idea was to take the (floating point) square root, round the result to the nearest integer, square that, and see whether he got the original number back. But he thought maybe there was - [Floating point numbers are a leaky abstraction](https://www.johndcook.com/blog/2009/04/06/numbers-are-a-leaky-abstraction/) - Knowing the details of how floating point numbers are implemented can help you avoid problems with them. - [Data privacy Twitter account](https://www.johndcook.com/blog/2019/04/07/data-privacy-twitter/) - New icon for Twitter account for data privacy and related topics. - [Diagram of conjugate prior relationships](https://www.johndcook.com/blog/2008/10/08/diagram-of-conjugate-prior-relationships/) - Here is a diagram to summarize some well-known conjugate prior relationships. See conjugate prior relationships for details regarding distributions and posterior parameters. - [Regular expression resources](https://www.johndcook.com/blog/2015/01/14/regular-expression-resources/) - Continuing the series of resource posts each Wednesday, this week we have notes on regular expressions: Regular expressions in PowerShell and Perl Regular expressions in Python Regular expressions in R Regular expressions in Mathematica C++ TR1 regular expressions See also blog posts tagged regular expressions. Last week: Probability resources Next week: Numerical computing resources - [Regular expressions in PowerShell and Perl](https://www.johndcook.com/blog/2008/10/07/regular-expressions-in-powershell-and-perl/) - This is one of the most popular pages on my website: Regular expressions in PowerShell and Perl It's about how you use regular expressions in PowerShell—how to do matches, replacements, etc.—rather than the grammar of regular expressions. It makes comparisons to Perl, in case you're already familiar with how to use regular expressions there. - [Regular expressions in Mathematica](https://www.johndcook.com/blog/2010/01/04/regular-expressions-mathematica/) - Regular expressions are fairly portable. There are two main flavors of regular expressions—POSIX and Perl—and more languages these days use the Perl flavor. There are some minor differences in what it means to be "like Perl" but for the most part languages that say they follow Perl's lead specify regular expressions the same way. The - [Technical notes](https://www.johndcook.com/blog/2015/03/04/technical-notes/) - For the last fifteen Wednesdays I've been posting links to technical notes. This is the end of the series. You can find most of the links from previous Wednesday posts on one page by going to technical notes from the navigation menu at the top of the site. - [Devnology podcast interview](https://www.johndcook.com/blog/2014/08/06/devnology-podcast-interview/) - When I was in Amsterdam earlier this year, Daan van Berkel interviewed me for the Devnology podcast. We talked about my winding career path, the overlap of math and computing, bringing math and computing closer together, formal methods, etc. The podcast was posted this afternoon here. [Update: Looks like the link has gone away.] Related - [New podcast interview](https://www.johndcook.com/blog/2017/03/17/rare-interview/) - Radim Řehůřek of Rare Technologies just posted an interview he and I did a few days ago. We mostly talk about consulting: getting started, finding work, good and bad leads, etc. - [Math diagrams](https://www.johndcook.com/blog/2014/02/04/math-diagrams/) - Some math diagrams on this site: Probability distributions Modes of convergence Special functions Gamma function identities Bessel functions Conjugate priors Topological vector spaces Category theory concepts General topology - [On this day](https://www.johndcook.com/blog/2020/01/14/on-this-day-2/) - Looking back at posts written on January 14 of previous years. - [Miscellaneous links](https://www.johndcook.com/blog/2009/09/07/miscellaneous-links-4/) - Science Why a walk in the park is good for your brain 10 of the world's strangest plant species Attempting to publish criticism of a scientific paper Computing Why "quick and dirty" software development isn't quick Macintosh changing its gamma value (why Apple is changing display brightness) Programmer turned lawyer turned programmer Math Famous math - [In Heidelberg](https://www.johndcook.com/blog/2014/09/20/in-heidelberg-2/) - I'm in Heidelberg again for the Heidelberg Laureate Forum. Next week I will be writing about the forum on the HLF blog and posting on Twitter with hash tag #hlf14. - [How to test a random number generator](https://www.johndcook.com/blog/2010/12/06/how-to-test-a-random-number-generator-2/) - Last year I wrote a chapter for O'Reilly's book Beautiful Testing (ISBN 0596159811). The publisher gave each of us permission to post our chapters online, and so here is Chapter 10: How to test a random number generator. Update: The chapter linked to above describes how to test transformations of a trusted uniform random number generator. For example, - [Where else to find me](https://www.johndcook.com/blog/2012/06/07/where-else-to-find-me/) - Here are some places I hang out besides this blog: Twitter Google+ Some things I've written: Software and articles about software Academic articles on math and statistics And some interviews I done: Microsoft Channel 9 Singularity Magazine Strongly Connected Components My email address is my last name at my domain name. - [Blog changes](https://www.johndcook.com/blog/2013/03/26/blog-changes/) - I'm about to make some changes to my blogging software. If all goes well, you'll just notice a different theme. If something goes wrong, come back a little later or send me a note. Thanks. - [Binomial coefficients](https://www.johndcook.com/blog/2008/09/08/binomial-coefficients/) - Equivalent definitions of binomial coefficients that generalize to useful situations not covered by the most basic definition. - [A note to new subscribers](https://www.johndcook.com/blog/2010/03/09/a-note-to-new-subscribers-2/) - Thank you for subscribing to my blog. I wanted to say a little about the blog for those of you who have just subscribed recently. I post a little more than one article a day on average on a variety of topics. Here’s a list of some of the most popular posts by category. This - [American Flag Prime](https://www.johndcook.com/blog/2025/08/15/american-flag-prime/) - A prime number that looks like a blackand-white image of an American flag when written in a block. - [Synchronizing metronomes](https://www.johndcook.com/blog/2011/09/07/synchronizing-metronomes/) - Video of synchronizing metronomes - [Merry Christmas](https://www.johndcook.com/blog/2009/12/25/merry-christmas/) - Linus' Christmas monologue - [Soccer match between German and Greek philosophers](https://www.johndcook.com/blog/2009/03/03/german-greek-philosophers-soccer/) - Monte Python video of a soccer match between German and Greek philosophers - [Numerical integration article posted](https://www.johndcook.com/blog/2008/12/08/numerical-integration-article-posted/) - This weekend CodeProject posted an article I wrote entitled Fast numerical integration. The algorithm in the article, introduced in the 1970s by Masatake Mori and Hidetosi Takahasi, is indeed fast. It integrates analytical functions over bounded intervals with the most accuracy for a fixed number of integration points. The CodeProject article includes source code and - [Functional programming in C++ with function objects](https://www.johndcook.com/blog/2008/12/19/functional-programming-in-c-with-function-objects/) - Functional programming in C++ with function objects - [Getting started with SciPy (Scientific Python)](https://www.johndcook.com/blog/2009/07/23/getting-started-with-scipy-scientific-python/) - CodeProject just published my article Getting Started with SciPy (Scientific Python) - [PyIMSL now free for non-commercial use](https://www.johndcook.com/blog/2009/11/16/pyimsl-now-free-for-non-commercial-use/) - Visual Numerics announced today that their PyIMSL Studio is now free for non-commercial use. PyIMSL contains Python wrappers for the IMSL scientific computing library and integrates with NumPy, matplotlib, etc. Related links IEEE floating point arithmetic in Python Probability distributions in SciPy - [Parameters and percentiles](https://www.johndcook.com/blog/2010/01/31/parameters-from-percentiles/) - Solving for probability distribution parameters given two percentile values. - [Probability distribution parameterizations in SciPy](https://www.johndcook.com/blog/2010/02/03/statistical-distributions-in-scipy/) - Parameterizations are the bane of statistical software. One of the most common errors is to assume that one software package uses the same parameterization as another package. For example, some packages specify the exponential distribution in terms of the mean but others use the rate. Python's SciPy library has a somewhat unusual approach to parameterization - [Python code for computing distribution parameters from percentiles](https://www.johndcook.com/blog/2010/02/03/computing-parameters-from-percentiles/) - A few days ago I wrote a post on finding parameters so that a probability distribution satisfies two percentile conditions. Since then I've written Python code to carry out the calculations described in that article and the accompanying technical report. The article is Finding probability distribution parameters from percentiles posted on CodeProject. The article comes - [Using py2exe with SciPy](https://www.johndcook.com/blog/2010/02/12/using-py2exe-with-scipy/) - py2exe is a program that takes Python code and produces a Windows executable that can run on computers that do not have Python installed. My focus here is in using py2exe on Python code that depends on SciPy. py2exe is itself a Python program, and its latest version is built for Python 2.6. The code - [Porting Python to C#](https://www.johndcook.com/blog/2010/06/18/porting-python-to-c/) - When people start programming in Python, they often mention having to type less: no braces, no semicolons, fewer type declarations etc. The difference may be more obvious when you go in the other direction, moving from Python to another language. This morning I ported some Python code to C# and was a little surprised how - [What does this code do?](https://www.johndcook.com/blog/2010/07/21/what-does-this-code-do/) - At the SciPy 2010 conference, a speaker showed several short code samples and asked us what each sample did. The samples were clearly written, but we had no comments to provide context. This was the last sample. def what( x, n ): if n < 0: n = -n x = 1.0 / x z - [Three surprises with the trapezoid rule](https://www.johndcook.com/blog/2010/12/02/three-surprises-with-the-trapezoid-rule/) - The trapezoid rule is an old idea, older than the definition of an integral. It's usually a crude method, but it can be very accurate when applied well. - [Top five Code Project articles](https://www.johndcook.com/blog/2011/02/24/top-five-code-project-articles/) - Here are the five most popular articles I've written for Code Project. Simple random number generation Five tips for floating point programming Pitfalls in random number generation Fast numerical integration Avoiding overflow, underflow, and loss of precision - [Maybe C++ hasn't jumped the shark after all](https://www.johndcook.com/blog/2011/07/06/maybe-c-hasnt-jumped-the-shark-after-all/) - A couple years ago I wrote a blog post Has C++ jumped the shark? I wondered how many people would care about the new C++ standard by the time it came out. I doubted that it would matter much to me personally. … if something is hard to do in C++, I just don’t use - [Floating point error is the least of my worries](https://www.johndcook.com/blog/2011/11/01/floating-point-worries/) - "Nothing brings fear to my heart more than a floating point number." — Gerald Jay Sussman The context of the above quote was Sussman's presentation We really don't know how to compute. It was a great presentation and I'm very impressed by Sussman. But I take exception to his quote. I believe what he meant - [The Python ecosystem](https://www.johndcook.com/blog/2011/12/07/python-ecosystem/) - The hard part about getting started with Python is not the language but the ecosystem. It's easy to find good references on the Python language, but it's harder to learn what packages are available, how to install them, etc. That was my experience, and Miz Nazim started with a similar observation in his article Python - [double.Epsilon != DBL_EPSILON](https://www.johndcook.com/blog/2012/01/05/double-epsilon-dbl_epsilon/) - Here's a pitfall in C# that keeps coming up. C# has a constant double.Epsilon that programmers coming from C naturally assume is the same as C's DBL_EPSILON. It's not. In fact, the former is hundreds of orders of magnitude smaller. C#'s double.Epsilon is the closest floating point number to 0. C's DBL_EPSILON is the distance - [Hunt down bad error messages](https://www.johndcook.com/blog/2012/08/22/hunt-down-bad-error-messages/) - My printer is unable to clean 51. It won't work, and all it says is "Unable to Clean 51." Here's my suggestion for finding such useless error messages in a code review: Write a script to extract all string literals from your source code, then read over the output. The beauty of this approach is - [Frequently asked questions](https://www.johndcook.com/blog/2013/10/10/faq/) - Here, in no particular order, are a few questions people frequently ask me. What kind of work do you do? Can you recommend an introductory statistics book? What programming language do you use? Why do you prefer Python to R? How do you charge for consulting? How do you run your Twitter accounts? Why don't - [Numerical computing resources](https://www.johndcook.com/blog/2015/01/21/numerical-computing-resources/) - This week's resource post: some numerical computing pages on this site. Stand-alone code for numerical computing Accurately computing running variance IEEE floating-point exceptions in C++ Double exponential integration Math.h in POSIX, ISO, and Visual Studio See also the Twitter account SciPyTip and numerical programming articles I've written for Code Project. Last week: Regular expressions Next week: - [Code Project articles](https://www.johndcook.com/blog/2015/02/11/code-project-articles/) - This week's resource post lists some articles along with source code I've posted on CodeProject. Probability Pitfalls in Random Number Generation includes several lessons learned the hard way. Simple Random Number Generation is a random number generator written in C# based on George Marsaglia's WMC algorithm. Finding probability distribution parameters from percentiles Numerical computing Avoiding - [Landau kernel](https://www.johndcook.com/blog/2019/08/20/landau-kernel/) - There are many proofs of the Weierstrass approximation theorem. This post sketches a proof using convolution with the Landau kernel. - [Golden Carnival of Mathematics](https://www.johndcook.com/blog/2011/07/05/golden-carnival-of-mathematics/) - Welcome to the 79th edition of the Carnival of Mathematics. By tradition, each edition begins with a bit of trivia about the number of the carnival. Gold has atomic number 79, so this is the golden edition. There is an older tradition of calling 25th things silver, 50th things gold, etc. However, I propose switching - [A thermonuclear word processor](https://www.johndcook.com/blog/2011/09/06/thermonuclear-word-processor/) - "I use Emacs, which might be thought of as a thermonuclear word processor." — Neal Stephenson From In the beginning was the command line Related posts Giving Emacs another try Bumblebee software Personal organization software - [Wonky but free](https://www.johndcook.com/blog/2013/02/25/wonky-but-free/) - Rachel Kroll wrote a blog post last Friday entitled I mortgaged my future with a Mac [link died]. The part I found most interesting is near the end of the post. Instead of staying with my wonky-but-free ways of doing things, I shifted all of my stuff over to the Mac. … Now when I - [Volunteer-generated errata pages](https://www.johndcook.com/blog/2021/06/10/community-errata/) - Is there a project to collect and generate errata pages? - [An unusual introduction to manifolds](https://www.johndcook.com/blog/2023/12/28/intro-to-manifolds/) - This tutorial offers a bridge between the abstract mathematics of manifolds and computational practice. - [Connecting the dots differently](https://www.johndcook.com/blog/2023/03/26/bootes/) - A couple weeks ago I wrote about how H. A. Rey introduced a new way of looking at the constellations, making them look more like their names. That post used Leo as an example. This post looks at Boötes (The Herdsman) [1]. Here is the constellation using the connections indicated in the IAU star chart. - [Two views of modernity](https://www.johndcook.com/blog/2012/12/12/two-views-of-modernity/) - Here are a couple descriptions of modernity that I've run across lately and found interesting. First, from Eva Brann: Now what is actually meant by "modern times?" The term cannot just mean "contemporary" because all times are con-temporary with themselves. Modern is a Latin word which means "just now." Modern times are the times which - [Houston secrets](https://www.johndcook.com/blog/2010/07/29/houston-secrets/) - Attractions around Houston that you might not know about even if you've lived there for years. - [3.5 ways to subscribe to this blog](https://www.johndcook.com/blog/2011/05/19/3-5-ways-to-subscribe-to-this-blog/) - Here are three and a half ways to subscribe to this blog. RSS. If you're unfamiliar with RSS, here's a video explaining what it is and how to use it. The video makes a nice analogy. Visiting blogs is like going to Blockbuster for a video. RSS is like Netflix where the video comes to - [If you're going to do XHTML, you'd better do it right](https://www.johndcook.com/blog/2008/04/14/if-youre-going-to-do-xhtml-youd-better-do-it-right/) - A cautionary tale about XHTML - [Migrating from HTML to XHTML](https://www.johndcook.com/blog/2008/08/03/migrating-from-html-to-xhtml/) - I migrated the HTML pages on my website to XHTML this weekend. I've been hesitant to do this after hearing a couple horror stories of how a slight error could have big consequences (for example, see how extra slashes caused Google to stop indexing CodeProject [link died]) but I took the plunge. Mostly this was - [Seven interviews](https://www.johndcook.com/blog/2011/03/16/seven-interviews/) - Here are six people I have interviewed. Rick Richter, CIO of Food for the Hungry Robert Ghrist, applied topologist Carl Franklin, musician and software developer Frederick Brooks, computer pioneer and author Cliff Pickover, mathematician and author Dan Bricklin, software developer and author Vincent Tan interviewed me here. - [Fifteen interviews](https://www.johndcook.com/blog/2011/06/24/fifteen-interviews/) - Seven Nine people I have interviewed: Rick Richter, CIO of Food for the Hungry Eric Floehr, owner of ForecastWatch Frederick Brooks, computer pioneer and author Robert Ghrist, applied topologist Cliff Pickover, mathematician and author Dan Bricklin, software developer and author Carl Franklin, musician and software developer Michael Hammer, GIMP developer and author (new) Sacha Chua, - [Text reviews for software](https://www.johndcook.com/blog/2008/04/11/text-reviews-for-software/) - When users find spelling and grammar errors in your software, your credibility takes a hit. Here's a script that helps find such errors. - [Automated software builds](https://www.johndcook.com/blog/2008/04/20/automated-software-builds/) - I learned from my first programming job not to assume a project will build just because the author says it will. - [Privacy and tomography](https://www.johndcook.com/blog/2023/04/01/privacy-and-tomography/) - Identifiability depends on contex. Riffing on a photo. How it relates to data privacy, differential privacy, etc. - [PACE: Property Assessed Clean Energy](https://www.johndcook.com/blog/2015/10/15/pace-houston/) - The Houston City Council passed a Resolution of Intent to adopt PACE: Property Assessed Clean Energy. PACE Houston will help owners take advantage of PACE. - [Graphing Japanese Prefectures](https://www.johndcook.com/blog/2022/09/12/japanese-prefectures/) - Using GraphViz to graph how Japan's 47 prefectures are connected - [Carnival of Mathematics #62](https://www.johndcook.com/blog/2010/02/05/carnival-of-mathematics-62/) - What is the Carnival of Mathematics? Math bloggers submit articles they have written recently and each month a host writes a post linking to the submitted posts. The sister carnival, Math Teachers at Play, focuses on math education and on math up through high school level. For a more thorough description of the two carnivals - [A priest, a Levite, and a Samaritan walk into a bar …](https://www.johndcook.com/blog/2009/01/06/a-priest-a-levite-and-a-samaritan-walk-into-a-bar/) - A rabbi, a priest, and a preacher walk into a bar. The bartender looks up and says "Is this some sort of joke?" Many jokes follow the pattern of three people doing something. The first two establish a pattern as the set up and the third provides the contrast for the punch line. You see - [Regular expressions in C++ TR1](https://www.johndcook.com/blog/2008/05/07/regular-expressions-in-c-tr1/) - Regular expressions are not a part of the C++ Standard Library quite yet, but there is a document (Technical Report 1, or TR1) that includes among other things a specification for regular expression support that will probably be added to the C++ standard eventually. The Boost library has supported TR1 for a while. Microsoft just - [PowerShell 2.0 for Windows XP etc.](https://www.johndcook.com/blog/2009/11/02/powershell-2-0-for-windows-xp-etc/) - PowerShell version 2.0 shipped with Windows 7 and with Windows Server 2008 R2, but it only recently became available for other versions of Windows. The release of PowerShell 2.0 has been more like a leak than a product launch. The announcement page hardly reads like an announcement. The title reads "Description of the Windows Management - [Exponential sums make pretty pictures](https://www.johndcook.com/blog/2017/10/07/exponential-sums-make-pretty-pictures/) - Exponential sums are a specialized area of math that studies series with terms that are complex exponentials. Estimating such sums is delicate work. General estimation techniques are ham-fisted compared to what is possible with techniques specialized for these particular sums. Exponential sums are closely related to Fourier analysis and number theory. Exponential sums also make - [Drawing Spirograph curves in Python](https://www.johndcook.com/blog/2018/08/30/drawing-spirograph-curves-in-python/) - Python code for drawing Spirograph-like curves. - [How to link to web pages from LaTeX-generated PDF](https://www.johndcook.com/blog/2008/11/24/link-to-web-pages-from-latex-pdf/) - This has been on my to-do list for a while, but I finally found out how to embed hyperlinks in a PDF file generated from LaTeX. Short answer: put \usepackage{hyperref} in your header, and when you want to link to a page, use the command \href{URL}{anchor text}. For example, \documentclass{article} \usepackage{hyperref} \begin{document} Here's a link - [Publish or perish](https://www.johndcook.com/blog/2009/01/13/publish-or-perish/) - From @divbyzero: "If 'publish or perish' were really true, Leonhard Euler would still be alive."—Eric Bach (Leonhard Euler (1707-1783) published more papers than any mathematician in history.) Correction: Apparently Euler wrote the most pages in math journals, but Paul Erdős wrote more individual papers. - [Twitter is not micro-blogging](https://www.johndcook.com/blog/2009/01/23/twitter-is-not-microblogging/) - Twitter is often described as a micro-blogging platform. Twitter posts and like blog posts, except they're limited to 140 characters (so they fit in a cell phone text message). You subscribe to Twitter posts (called "tweets") sorta like you subscribe to a blog. Some people, like Kathy Sierra, do use Twitter for micro-blogging. Her tweets - [Apple Mac turns 25 today](https://www.johndcook.com/blog/2009/01/24/apple-mac-turns-25-today/) - The Mac came out 25 years ago today. Here's the article. Hat tip @divbyzero. I sold Macs for a little while. I worked at the UT computer store one summer. At the time, that store was the biggest distributor of Macs in the country. I've never owned a Mac. I think it would be great - [How to grep Twitter](https://www.johndcook.com/blog/2009/03/12/grep-twitter-regex/) - Twitter has an extensive search API. To build the URL for a query, start with the base https://search.twitter.com/search.atom?q=. To search for a word, just append that word to the base, such as https://search.twitter.com/search.atom?q=Coltrane to search for tweets containing "Coltrane." To search for a term within a particular user's tweet stream, start with the base URL - [Typesetting music with LilyPond](https://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/) - I tried typesetting music in LaTeX some time ago and gave up. The packages I found were hard to install, the examples didn't work, etc. This weekend I decided to try again. I tried plowing through the MusiXTeX documentation and got no further than I did last time. I posted a note on StackOverflow and - [Variations on a theme of Newton](https://www.johndcook.com/blog/2009/05/26/variations-on-a-theme-of-newton/) - Isaac Newton famously said If I have seen farther than others it is because I have stood on the shoulders of giants. Later Mathematician R. W. Hamming added Mathematicians stand on each other's shoulders while computer scientists stand on each other's toes. Finally, computer scientist Hal Abelson quipped If I have not seen farther, it - [Financial control and useless projects](https://www.johndcook.com/blog/2009/07/17/financial-control-and-useless-projects/) - Tom DeMarco has an article in the latest IEEE Software in which he gives an example of two hypothetical software projects. Both are expected to cost around a million dollars. One is expected to return a value of 1.1 million and the other 50 million. Financial controls are crucial for the former but not for - [I disagree with Linus Torvalds about C++](https://www.johndcook.com/blog/2009/09/15/linus-torvalds-cpp/) - People wanting to write a large C program usually end up reinventing large parts of C++ and doing it poorly. - [JavaScript: A picture is worth a thousand words](https://www.johndcook.com/blog/2009/09/28/javascript-picture/) - Here's a photo posted by David Walsh on Twitter on yesterday. Related links: Programming language subsets I wish someone would write "R, The Good Parts" Programming language fatigue - [A third of dinosaur species never existed?](https://www.johndcook.com/blog/2009/10/11/a-third-of-dinosaur-species-never-existed/) - According to this article from National Geographic News, some experts now believe the number of dinosaur species has been overestimated. Some specimens that were previously believed to be distinct species are now believed to be juvenile specimens of other species. (Hat tip to Eric Geiger.) - [New daily tip feeds: RegexTip and ProbFact](https://www.johndcook.com/blog/2009/12/01/regextip-and-probfact/) - A few weeks ago I started a Twitter account @SansMouse with daily tips on Windows keyboard shortcuts. That's gone well, so I decided start two more daily tip accounts: @RegexTip and @ProbFact. If you don't use Twitter, you can follow these tip via your blog reader. Here are the RSS feeds for RegexTip and ProbFact. - [Twitter feeds to help with New Year's resolutions](https://www.johndcook.com/blog/2009/12/31/four-twitter-feeds-to-help-with-new-years-resolutions/) - I have four Twitter accounts that send out one tip per day. One of these might help you with a New Year's resolution. If you don't use Twitter, you can follow these Twitter accounts by subscribing to their RSS feeds. [Update: Twitter really doesn't want to you to use RSS. I've posted a couple times - [A little optimization and a challenge](https://www.johndcook.com/blog/2010/02/11/a-little-optimization/) - Waldir Pimenta asked me whether it is possible to test the condition max(a, b) / min(a, b) < r without computing max(a, b) or min(a, b). Here a> 0, b> 0, and r > 1. (If r ≤ 1, the condition is always false.) The inequality has to be evaluated in an inner loop of - [Euclid's proof that there are infinitely many primes](https://www.johndcook.com/blog/2010/02/13/euclids-proof-that-there-are-infinitely-many-primes/) - Paul Erdős had this notion that God kept a book of the best proofs. Erdős called God's book simply "the book." Springer recently published Proofs from THE BOOK, a collection of elegant proofs that the authors suppose might be in God's book. For many mathematicians, the first proof that comes to mind as a candidate - [Interview with Clojure author](https://www.johndcook.com/blog/2010/03/08/interview-with-clojure-author/) - Simple-talk has an interview with Rich Hickey, author of the programming language Clojure (pronounced "closure"). Clojure is a dialect of Lisp designed to run on top of the Java Virtual Machine. The language is also being ported to the .NET framework as Clojure CLR. Two things stood out to me in the interview: a comparison - [Yahoo translation fail](https://www.johndcook.com/blog/2010/03/10/yahoo-translation-fail/) - Allen from the Wave Behind blog translated my blog post Just in case versus just in time into Chinese. I appreciate that Allen went to the trouble of doing the translation. I can't read Chinese, but people who can told me he did a good job. Mark Biek pointed out the quality of the Google - [Mac OS X keyboard shortcuts](https://www.johndcook.com/blog/2010/04/06/mac-os-x-keyboard-shortcuts/) - Ben Jaffe has started a Twitter account @commandtab with regular keyboard shortcuts for the Mac, something similar to my account @SansMouse for Windows. You can hear Ben talk about his new Twitter account on the GeekSpeak radio program and podcast. Related links: Four patterns in Windows keyboard shortcuts Using Windows without a mouse Twitter daily - [Daily tip winner and statistics](https://www.johndcook.com/blog/2010/04/28/daily-tip-winner-and-statistics/) - Giveaway winner Nicholas Dunn is the winner of the Twitter daily tip giveaway. A coveted RegexTip coffee mug is on its way. Update (5 May 2010): Nick posted a photo of his mug. Follower statistics I ran some statistics on the daily tip sites. The full data are available here. There are 1406 unique followers - [Losing patience with wastes of time](https://www.johndcook.com/blog/2010/05/27/losing-patience-with-wastes-of-time/) - Peter Bergman wrote an HBR blog post last week How (any Why) to Stop Multitasking. Bergman tried to stop multitasking for a week as an experiment. His post lists six benefits from his experiment including this observation: I lost all patience for things I felt were not a good use of my time. Multitasking can - [Write-only articles](https://www.johndcook.com/blog/2010/06/23/write-only-articles/) - I saw this on Twitter yesterday: About 200,000 academic journals are published in English. The average number of readers per article is 5. I don't know where those numbers came from, but five readers per article sounds about right. When I was a grad student, I felt like a fraud for writing papers that I - [Miscellaneous Emacs adventures](https://www.johndcook.com/blog/2010/07/28/miscellaneous-emacs-adventures/) - I recently found out there's an Emacs command M-x woman that's a pun on “w/o man”, i.e. a way to read online help without using the usual man command. * * * I tried to edit a 1.2 GB text file with Emacs the other day. I got an error saying that Emacs has a - [Fall Twitter giveaway](https://www.johndcook.com/blog/2010/09/14/fall-twitter-giveaway/) - I have seven daily tip accounts on Twitter. These accounts post once a day, Monday through Friday, plus occasional unscheduled posts. Windows keyboard shortcuts Regular expression tips TeX and LaTeX tips Probability Algebra and number theory Topology and geometry Real and complex analysis Please help new people find out about these accounts by linking - [Daily tip Twitter account FAQ](https://www.johndcook.com/blog/2010/09/23/daily-tip-twitter-account-faq/) - This post answers some frequently asked questions regarding my daily tip accounts on Twitter. How many followers do you have? About 2800 people are following at least one of these accounts at the time of writing, each following between 2 and 3 accounts on average for a total of about 5900 follows combining all accounts. - [We have a winner](https://www.johndcook.com/blog/2010/09/27/we-have-a-winner/) - Gary Collard was the winner of the Twitter daily tip giveaway. Many thanks to everyone who participated. - [Math/CS cheat sheet](https://www.johndcook.com/blog/2010/10/03/mathcs-cheat-sheet/) - Here's something called a theoretical computer science cheat sheet. I don't know whether I agree with the name, but it's a nice cheat sheet. The first two pages of the cheat sheet have to do with sums, combinatorics, and recurrence relations, the kinds of things you'd find in Concrete Mathematics and certainly useful in theoretical - [Programmer problem solving sequence](https://www.johndcook.com/blog/2010/10/22/programmer-problem-solving-sequence/) - From Phillipe Leybaert: 2010 developer's problem solving sequence: Google Coworkers StackOverflow RTFM Think - [Object oriented vs. functional programming](https://www.johndcook.com/blog/2010/11/03/object-oriented-vs-functional-programming/) - From Michael Feathers: OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts. This explains some of the tension between object oriented programming and functional programming. The former tries to control state behind object interfaces. The latter tries to minimize state by using pure functions as much as possible. - [Perpendicular and relatively prime](https://www.johndcook.com/blog/2010/11/16/perpendicular-and-relatively-prime/) - Donald Knuth recommends using the symbol ⊥ between two numbers to indicate that they are relatively prime. For example: The symbol is denoted \perp in TeX because it is used in geometry to denote perpendicular lines. It corresponds to Unicode character U+27C2. I mentioned this on TeXtip yesterday and someone asked for the reason for - [New Twitter account: StatFact](https://www.johndcook.com/blog/2010/11/30/new-twitter-account-statfact/) - I'm starting a new daily tip account on Twitter. @StatFact will post one statement from statistics per day, drawing from Bayesian and frequentist statistics. Like my other daily tip accounts, StatFact will post Monday through Friday on a regular schedule with a few unscheduled tweets sprinkled in occasionally. I'm using a product sign as the - [New Twitter account: CompSciFact](https://www.johndcook.com/blog/2010/11/30/new-twitter-account-compscifact/) - Next week I'm starting @CompSciFact. This Twitter account will post one fact from computer science per day, Monday through Friday. I'll also have a few unscheduled posts from time to time. (I announced @StatFact earlier today. There are no more announcements coming! I don't plan to start any more Twitter accounts any time soon.) The - [Typesetting chemistry in LaTeX](https://www.johndcook.com/blog/2010/12/08/typesetting-chemistry-in-latex/) - Yesterday I gave the following tip on TeXtip: Set chemical formulas with math Roman. Example: sulfate is $mathrm{SO_4^{2-}}$ TorbjoernT and scmbradley let me know there's a better way: use Martin Hansel's package mhchem. The package is simpler to use and it correctly handles subtle typographical details. Using the mhchem package, sulfate would be written ce{SO4^2-}. - [Daily tips update](https://www.johndcook.com/blog/2011/01/17/daily-tips-update/) - RegexTip, a Twitter account for learning regular expressions, starts over today with basics and will progress to more advanced properties over time. SansMouse, an account for Windows keyboard shortcuts, started over with basics two weeks ago. Both RegexTip and SansMouse are in a loop, progressing from most basic to more advanced features. (Or perhaps I - [Twitter daily tip news](https://www.johndcook.com/blog/2010/02/08/twitter-daily-tip-news/) - I have five Twitter accounts that send out one tip per day, including a new one I just added last week. Regular expressions @RegexTip started over today. It's a cycle of tips for learning regular expressions. It sticks to the regular expression features common to Python, Perl, C#, and many other programming languages. This account - [Keyboard shortcuts for Mac, Linux, and Windows](https://www.johndcook.com/blog/2011/02/03/keyboard-shortcuts-for-mac-linux-and-windows/) - As many of you know, I have a Twitter account @SansMouse that posts one Windows keyboard shortcut per day. I'm starting to experiment with adding Mac and Linux keyboard shortcuts as well. For Linux, I'll stick to Ubuntu with the default GNOME window manager. SansMouse will continue to post one Windows shortcut each weekday. I'll - [Scientific Python on Twitter](https://www.johndcook.com/blog/2011/02/21/scientific-python-on-twitter/) - Next week I'm starting a new daily tip Twitter account: @SciPyTip. This account will post on things related to scientific computing in Python, including the SciPy library, related software, and scientific computing in general. Full list of daily tip accounts - [The solar system in a glass of wine](https://www.johndcook.com/blog/2011/01/01/the-solar-system-in-a-glass-of-wine/) - William Blake's poem Auguries of Innocence opens with these famous lines: To see a world in a grain of sand, And a heaven in a wild flower, Hold infinity in the palm of your hand, And eternity in an hour. This poem came to mind when I saw @mathematicsprof post the following on Twitter: At - [Educating versus credentialing](https://www.johndcook.com/blog/2011/01/03/educating-versus-credentialing/) - "Colleges aren't really in the education business. Colleges are in the credentialing business." -- Josh Kaufman Of course colleges would like to educate students along the way, but ultimately they are in the business selling credentials. Thanks to Jeff Shelton for pointing out the quote above. Related posts Fairy dust on the diploma Accelerated learning - [Hanlon's razor and corporations](https://www.johndcook.com/blog/2011/01/18/hanlons-razor-and-corporations/) - Hanlon's razor says Never attribute to malice that which is adequately explained by stupidity. At first it seems just an amusing little aphorism, something you might read on a bumper sticker, but I believe it's profound. It's a guide to understanding so much of the world. Here I'll focus on what it says about corporations. - [Limerick primes](https://www.johndcook.com/blog/2011/03/08/limerick-primes/) - The other day, Futility Closet posted this observation: 10102323454577 is the smallest 14-digit prime number that follows the rhyme scheme of a Shakespearean sonnet (ababcdcdefefgg). I posted this on AlgebraFact and got a lot of responses. One was from Matt Parker who replied that 11551 was the smallest prime with a limerick rhyme scheme. So - [Engineers save millions of lives in Japan](https://www.johndcook.com/blog/2011/03/12/engineers-save-millions-of-lives-in-japan/) - From Dave Ewing via Roberto Montagna: The headline you won't be reading: "Millions saved in Japan by good engineering and government building codes". But it's the truth. The loss of life in Japan is tragic, but it would have been far worse without good engineering. Update: As Tim points out in the comments below,The New - [Daily tip accounts broader than names imply](https://www.johndcook.com/blog/2011/03/18/daily-tip-accounts-broader-than-names-imply/) - Some of my daily tip Twitter accounts are a little broader than their names imply. Account names need to be fairly short, so they can't be too descriptive. Here are fuller descriptions of some of the accounts. TeXtip is primarily about typesetting in TeX and LaTeX, but it also posts content about typography in general. - [Python for high performance computing](https://www.johndcook.com/blog/2011/03/21/python-hpc/) - William Scullin's talk from PyCon 2011: Python for high performance computing. At least in our shop [Argonne National Laboratory] we have three accepted languages for scientific computing. In this order they are C/C++, Fortran in all its dialects, and Python. You'll notice the absolute and total lack of Ruby, Perl, Java. If you're interested in - [Mersenne primes and world records](https://www.johndcook.com/blog/2011/04/04/mersenne-prime-records/) - Here's an interesting account of the largest known primes over time. Thanks to @mathematicsprof for pointing this out. Ever since 1952, the largest known prime has been a Mersenne prime, with one exception in 1989. One reason is that it is simple to test whether Mersenne numbers are prime using the Lucas-Lehmer test. The algorithm - [New Twitter account: RLangTip](https://www.johndcook.com/blog/2011/05/16/new-twitter-account-rlangtip/) - I'm starting a new daily tip Twitter account: RLangTip. This account will have one regularly scheduled tip per day, Monday through Friday, on the R language and related topics. I'll also throw in a few unscheduled tweets now and then. If you're interested in R, you may also be interested in other daily tip accounts - [Why do C++ folks make things so complicated?](https://www.johndcook.com/blog/2011/06/14/why-do-c-folks-make-things-so-complicated/) - This morning Miroslav Bajtoš asked "Why do C++ folks make things so complicated?" in response to my article on regular expressions in C++. Other people asked similar questions yesterday. My response has two parts: Why I believe C++ libraries are often complicated. Why I don't think it has to be that way. Why would someone - [How to fit an elephant](https://www.johndcook.com/blog/2011/06/21/how-to-fit-an-elephant/) - John von Neumann famously said With four parameters I can fit an elephant, and with five I can make him wiggle his trunk. By this he meant that one should not be impressed when a complex model fits a data set well. With enough parameters, you can fit any data set. It turns out you - [Two-finger scrolling on Windows](https://www.johndcook.com/blog/2011/07/19/two-finger-scrolling-on-windows/) - One of my favorite features of Mac laptops is two-finger scrolling. This lets you scroll down a long document similar to the way the middle wheel does on a Windows mouse. I mentioned on Twitter this evening that it would be nice if Windows had this feature. Apparently many newer Windows laptops come with this - [Motion sensor faucet dance](https://www.johndcook.com/blog/2011/07/19/motion-sensor-faucet-dance/) - I suggested on Twitter this morning that someone come up with a name for the funny little dance we do when trying to figure out how to make water faucets with motion sensors work. Here are the replies. Fauce-a-nova (Patrick Honner) Sensor Shimmy (Rudolf Winestock) Hand Jive (David B. Skalak) Any more ideas? - [RLangTip changing hands](https://www.johndcook.com/blog/2011/08/02/rlangtip-changing-hands/) - I've decided to hand my Twitter account RLangTip over to the folks at Revolution Analytics starting next week. I thought it would be better to give the account to someone who is more enthusiastic about R than I am, and so I offered it to David Smith. If you've enjoyed RLangTip so far, I expect - [More than sed and awk](https://www.johndcook.com/blog/2011/11/08/more-than-sed-and-awk/) - I'm going to expand the content of my SedAwkTip twitter account. I've covered the most commonly used features of sed and awk, and rather than go into more advanced/obscure features of these languages, I'm going to add tips on other common command line software. I'll probably change the name of the account to reflect the - [Better mousetraps](https://www.johndcook.com/blog/2011/11/30/better-mousetraps/) - From Ike Pigott: Build a better mousetrap, and cats will beat a path to your door to picket. Related post: It takes more than a better mousetrap - [Twitter milestone](https://www.johndcook.com/blog/2012/01/31/twitter-milestone/) - There are now over 100,000 followers across my various daily tip Twitter accounts. The three most popular are CompSciFact, AlgebraFact, and ProbFact. Thank you everyone for following and for providing feedback. More Twitter posts How to subscribe to a Twitter post via RSS Daily tip accounts broader than their names imply - [What happened to XSLT?](https://www.johndcook.com/blog/2009/03/16/what-happened-to-xslt/) - Around 2000, some people believed that nearly all programming would be a matter of transporting and transforming XML. XML would be the universal data format, and all software would be a matter of transforming XML. If that were the case, then it would be very handy to use a language designed especially for transforming XML. - [How many musical scales are there?](https://www.johndcook.com/blog/2017/09/30/how-many-musical-scales-are-there/) - How many musical scales are there? That's not a simple question. It depends on how you define "scale." For this post, I'll only consider scales starting on C. That is, I'll only consider changing the intervals between notes, not changing the starting note. Also, I'll only consider subsets of the common chromatic scale; this post - [No matter how dubious](https://www.johndcook.com/blog/2025/03/30/no-matter-how-dubious/) - Using dubious methods to find a solution is fine, and often necessary, as long as you can verify by more reliable methods that you have indeed found a solution. - [Looking back at Martin Gardner's RSA article](https://www.johndcook.com/blog/2025/08/05/martin-gardners-rsa/) - Looking back at the article that popularized public key cryptography, Martin Gardner's article on RSA from September 1977. - [Analyzing the Federalist Papers](https://www.johndcook.com/blog/2025/08/07/federalist-papers/) - The Federalist Papers were the subject of early NLP and Bayesian analysis. Applying TF-IDF to find the most important words in each essay. - [Recamán's sequence](https://www.johndcook.com/blog/2025/05/05/recamans-sequence/) - Recamán's sequence, implemented in Python and illustrated as a graphic and as sheet music. - [Addition theorems](https://www.johndcook.com/blog/2023/10/06/addition-theorems/) - Some generalizations of sine and cosine satisfy addition theorems and some do not. There's a deep reason for this discovered by Weierstrass. - [Mickey Mouse, Batman, and conformal mapping](https://www.johndcook.com/blog/2019/08/23/conformal-mapping/) - A conformal map between two regions in the plane preserves angles [1]. If two curves meet at a given angle in the domain, their images will meet at the same angle in the range. Two subsets of the plane are conformally equivalent if there is a conformal map between them. The Riemann mapping theorem says - [Factoring RSA100](https://www.johndcook.com/blog/2025/08/04/factoring-rsa100/) - Comparing the time required to factor the first of the RSA challenge numbers in 1991 and in 2025. - [Non-associative multiplication](https://www.johndcook.com/blog/2022/02/01/non-associative/) - How you parenthesize products can matter. Examples from octonions and matrix multiplication. For the latter, it's efficiency that changes. - [Sierpinski triangle strikes again](https://www.johndcook.com/blog/2017/09/23/sierpinski-triangle-strikes-again/) - The Sierpinski triangle comes up in surprising ways. Here we show how it arises in cellular automata. - [Mental math posts](https://www.johndcook.com/blog/2025/09/17/mental-math-posts/) - Outline of mental math posts. Some basic things like divisibility rules, but also more advanced topics like computing logs or gamma functions. - [Binary surprise](https://www.johndcook.com/blog/2019/10/19/binary-surprise/) - There's a surprising connection between which regular n-gons can be constructed with a ruler and strait edge, binary numbers, and the Sierpinski triangle. - [Queueing theory and regular expressions](https://www.johndcook.com/blog/2019/10/14/queueing-regexp/) - Queueing theory is the study of waiting in line. That may not sound very interesting, but the subject is full of surprises. For example, when a server is near capacity, adding a second server can cut backlog not just in half but by an order of magnitude or more. More on that here. In this - [Kinds of elliptic integrals](https://www.johndcook.com/blog/2022/11/07/elliptic-integral-kinds/) - What an elliptic integral is, and how elliptic integrals can be written as linear combinations of three particular kinds. - [Randomly selecting points inside a triangle](https://www.johndcook.com/blog/2025/09/11/random-inside-triangle/) - How to uniformly sample points from a triangle. One method that seems plausible but isn't uniform, and a clever method that is uniform. - [1420 MHz](https://www.johndcook.com/blog/2025/09/18/1420-mhz/) - Pioneer, Voyager, and the Wow! signal. Communicating with extraterrestrials at 1420 MHz. - [An inverse problem for the quadratic equation](https://www.johndcook.com/blog/2025/09/24/an-inverse-problem-for-the-quadratic-equation/) - Typically one has coefficients of a quadratic equation and finds roots. What if one has a root and seeks integer coefficients? We consider algorithms for this. - [Fitting a double exponential function to three points](https://www.johndcook.com/blog/2025/09/29/fitting-a-double-exponential/) - Fitting a double exponential function f(x) = a exp( b exp(cx) ) to three data points. - [Time needed to factor large integers](https://www.johndcook.com/blog/2025/09/30/time-needed-to-factor-large-integers/) - How long would it take to factor a large integer, such as a cryptographic key, based on its size in bits? - [log log x](https://www.johndcook.com/blog/2025/09/29/log-log-x/) - What happens to log log x as you change the base of the log? - [The most interesting logs](https://www.johndcook.com/blog/2012/11/15/logarithms/) - In advanced math, "log" almost always means "log base 10." - [Extrapolating quantum factoring](https://www.johndcook.com/blog/2025/09/28/extrapolating-quantum-factoring/) - It doesn't look like quantum computers will break public key encryption any time soon if you extrapolate from the size of numbers factored so far. - [Post-quantum RSA with gargantuan keys](https://www.johndcook.com/blog/2025/09/26/post-quantum-rsa/) - If and when practical scalable quantum computers become available, RSA encryption would be broken, at least for key sizes currently in use. A quantum computer could use Shor's algorithm factor n-bit numbers in time on the order of n². The phrase "quantum leap" is misused and overused, but this would legitimately be a quantum leap. - [Subscribing by email](https://www.johndcook.com/blog/2017/06/28/subscribing-by-email/) - You can subscribe to my blog by RSS. I also have a brief newsletter you could sign up for. There are links to these in the sidebar of the blog: If you subscribe by email, you'll get an email each morning containing the post(s) from the previous day. I just noticed a problem with email - [Leading digits of powers of 2](https://www.johndcook.com/blog/2017/06/20/leading-digits-of-powers-of-2/) - The first digit of a power of 2 is a 1 more often than any other digit. Powers of 2 begin with 1 about 30% of the time. This is because powers of 2 follow Benford's law. We'll prove this below. When is the first digit of 2n equal to k? When 2n is between - [Pros and cons of the term "data science"](https://www.johndcook.com/blog/2015/03/30/label-data-science/) - The term "data science" has its flaws, but so does the term "statistics." - [5,000th post](https://www.johndcook.com/blog/2025/05/06/5000th-post/) - Looking back on five thousand blog posts. - [Miscellaneous](https://www.johndcook.com/blog/2019/02/27/miscellaneous/) - Image editing, exponential sums, podcast interview, entropy, newsletter, and the letter S. - [Chaos + Chaos = Order](https://www.johndcook.com/blog/2019/03/07/chaos-chaos-order/) - If you take these chaotic-looking values for your x-coordinates and these chaotic-looking values for your y coordinates you get this image that looks more ordered. The image above is today's exponential sum. - [Gibbs phenomenon](https://www.johndcook.com/blog/2020/06/10/gibbs-phenomenon/) - The Fourier series for a piecewise continuous function wiggles violently near a discontinuity, overshooting on one side and undershooting on the other. - [Cubic calendars](https://www.johndcook.com/blog/2020/11/29/cubic-calendars/) - How many consecutive numbers can you produce with a calendar that uses cubes with a digit on each face? - [A stiffening spring](https://www.johndcook.com/blog/2021/03/04/a-stiffening-spring/) - It's not surprising what the limiting behavior of this system is, but it may be surprising how it gets there. - [Projective duality](https://www.johndcook.com/blog/2022/04/25/projective-duality/) - You can reverse the roles of points and lines in projective geometry and the geometry doesn't change. - [Shape of moon orbit around sun](https://www.johndcook.com/blog/2022/10/13/moon-around-sun/) - If a moon orbits and planet and a planet orbits a star, what is the shape of the moon's orbit around the star? Depends on a couple factors. - [Blog RSS feed](https://www.johndcook.com/blog/2023/11/03/blog-rss-feed/) - Having problems with RSS? Possible solution and other ways to follow. - [Conway's pinwheel tiling](https://www.johndcook.com/blog/2025/09/25/conways-pinwheel-tiling/) - Conway discovered a right triangle that can be divided into five similar triangles and used this triangle to create an aperiodic tiling of the plane. - [Mollweide map projection and Newton's method](https://www.johndcook.com/blog/2025/09/21/mollweide-newton/) - The Mollweide equal-area projection map requires solving a nonlinear equation. Newton's method solves this equation well except at high latitudes. - [Inverting series that are flat at zero](https://www.johndcook.com/blog/2025/09/21/mollweide-for-high-latitudes/) - The Mollweide map projection motivates inverting a power series that has first derivative zero at the point where you'd like a series solution - [Divisibility by base + 1](https://www.johndcook.com/blog/2023/02/22/base-plus-1/) - The trick for testing whether a base 10 number is divisible by 11 works in other bases if you interpret "11" in the new base. - [Divisibility by any prime](https://www.johndcook.com/blog/2021/02/17/divisibility-by-any-prime/) - A general approach to creating rules for testing divisibility by any prime that typically take less effort than long division. - [Tricks for radix conversion by hand](https://www.johndcook.com/blog/2025/01/23/radix-conversion/) - Radix conversion is tedious to carry out by hand in general, but in some special cases there are tricks to make it easier. - [Casting out z's](https://www.johndcook.com/blog/2011/05/12/casting-out-zs/) - "Casting out nines" is a trick for determining the remainder when a number is divided by nine. Just add the digits of the number together. For example, what's the remainder when 3679 is divided by 9? The same as when 3 + 6 + 7 + 9 = 25 is divided by 9. We can - [Test for divisibility by 13](https://www.johndcook.com/blog/2020/11/10/test-for-divisibility-by-13/) - How to manually test whether a large number is divisible by 7, 11, and 13 all at the same time. - [A footnote to year share](https://www.johndcook.com/blog/2022/06/06/a-footnote-to-year-share/) - Why the year share method recommended in a previous post is easier to use and why it works. - [Year share](https://www.johndcook.com/blog/2022/05/23/year-share/) - Calculating the day of the week requires calculating the so-called year share. Here are several ways to do this mentally easier than the direct approach. - [Antenna length: Another rule of 72](https://www.johndcook.com/blog/2024/03/27/antenna-length-another-rule-of-72/) - The Rule of 72 for interest and the Rule of 72 for dipole antenna length - [Conway's factoring trick](https://www.johndcook.com/blog/2022/07/12/conways-factoring/) - John Conway's 150 method for testing for divisibility by small primes. - [Day of the week centuries from now](https://www.johndcook.com/blog/2025/09/18/day-of-the-week-centuries-from-now/) - Yesterday I wrote a post outlining mental math posts I'd written over the years. I don't write about mental math that often, but I've been writing for a long time, and so the posts add up. In the process of writing the outline post I noticed a small gap. In the post on mentally calculating - [The AI fork in the road](https://www.johndcook.com/blog/2025/09/18/ai-fork/) - If AI can do part of your job, you're likely to either be fired or promoted. - [John Conway's mental factoring method and friends](https://www.johndcook.com/blog/2023/03/03/conway-factoring/) - Mental factoring techniques that test for divisibility of a sequence of primes, reusing work from each step in the next step. - [A mental random number generator](https://www.johndcook.com/blog/2025/09/10/mental-rng/) - A random number generator you can run in your head. It's adequate for some tasks, better than trying to make up a random sequence. - [Leap seconds](https://www.johndcook.com/blog/2020/02/05/leap-seconds/) - Leap seconds are not as familiar as leap days. What are they? Why are they necessary? Why are they controversial? - [Mentally calculating the day of the week](https://www.johndcook.com/blog/2022/05/07/day-of-the-week/) - How to determine the day of the week for any date. - [Martian Leap Years](https://www.johndcook.com/blog/2025/02/28/martian-leap-years/) - What would the analog of leap years be on Mars? - [Unix Time and a Modest Proposal](https://www.johndcook.com/blog/2024/12/27/unix-time/) - Why Unix time is not exactly what it is often described to be, and a proposal for fixing it. - [What exactly is a second?](https://www.johndcook.com/blog/2024/12/29/what-exactly-is-a-second/) - A second is now defined in terms of periods of radiation from a cesium atom. Why was this necessary? Why cesium? What the particular number of periods? - [Cycle of New Year's Days](https://www.johndcook.com/blog/2024/12/31/cycle-of-new-years-days/) - How the day of the week for New Year's Day cycles every 28 years, almost. - [A bit-twiddling marvel](https://www.johndcook.com/blog/2025/05/20/a-bit-twiddling-marvel/) - A very clever, very cryptic hack. - [2010 calendar of lost mathematical art](https://www.johndcook.com/blog/2010/01/03/2010-nomogram-calendar/) - Rod Carvalho wrote a post this morning announcing a beautiful 2010 calendar created by Ron Doerfler. Doerfler's blog is entitled Dead Reckonings: Lost Art in the Mathematical Sciences. The calendar is an example of such lost art. It is illustrated with nomograms, ingenious ways of computing with graphs before electronic calculators were common. The illustrations - [Calendars, Connections, and Cats](https://www.johndcook.com/blog/2010/01/06/heaviside/) - James Burke had a television series Connections in which he would create a connection between two very different things. For example, in one episode he starts with the discovery of the touchstone for testing precious metals and tells a winding tale of how the touchstone led centuries later to the development of nuclear weapons. I - [Another math calendar from Ron Doerfler](https://www.johndcook.com/blog/2011/01/09/another-beautiful-interesting-calendar-from-ron-doerfler/) - Last year Ron Doerfler made a beautiful calendar with images from graphical computing, charts used as computational aids before desktop calculators were ubiquitous. Ron has made a new calendar and this year's theme is lightning computing, tricks for mental calculation. The calendar is available for download as a PDF or for purchase in hard copy. - [Calendars and continued fractions](https://www.johndcook.com/blog/2018/05/30/calendars-and-continued-fractions/) - Calendars are based on three frequencies: the rotation of the Earth on its axis, the rotation of the moon around the Earth, and the rotation of the Earth around the sun. Calendars are complicated because none of these periods is a simple multiple of any other. The ratios are certainly not integers, but they're not - [Safe Harbor and the calendar rollover problem](https://www.johndcook.com/blog/2019/04/08/hipaa-years/) - The Safe Harbor provision for dates implying very old age can lead to strange requirements if not interpreted correctly. - [Complex analysis calendar](https://www.johndcook.com/blog/2022/01/24/complex-analysis-calendar/) - Calendar with beautiful images made from complex phase plots. - [Gregorian Calendar and Number Theory](https://www.johndcook.com/blog/2024/12/16/gregorian-calendar/) - The design of the Gregorian calendar can be explained by looking at how best to approximate 365.2422 with a rational number. - [Perpetual Calendars](https://www.johndcook.com/blog/2024/12/16/perpetual-calendars/) - There are 14 possible calendar patterns using the Gregorian calendar. Why is that? How common is each one - [A calendar for Mars](https://www.johndcook.com/blog/2025/02/28/a-calendar-for-mars/) - Why the number of days in a month should vary more on Mars than on Earth. - [Running the Gregorian calendar backwards](https://www.johndcook.com/blog/2025/04/21/gregorian-backwards/) - What effect would it have on ancient dates if we pushed the Gregorian calendar back in time? - [Learning languages with the help of algorithms](https://www.johndcook.com/blog/2025/09/17/learning-languages-with-the-help-of-algorithms/) - How do you identify books in another language that are rich in vocabulary you would like to learn? Here we discuss mathematical methods for solving this problem. - [Morse code beyond the solar system](https://www.johndcook.com/blog/2025/09/17/morse-code-beyond-the-solar-system/) - Morse code message on Voyager's Golden Record. - [Cycles in Marsaglia's mental RNG](https://www.johndcook.com/blog/2025/09/16/cycles-in-mental-rng/) - Marsaglia's mental random number generator has a bad seed to avoid. - [Monero's seed phrase words](https://www.johndcook.com/blog/2025/09/16/monero-seed-words/) - How Monero's list of words for seed phrases differs from the list used in Bitcoin and other cryptocurrencies - [Area of the unit disk after a Möbius transformation](https://www.johndcook.com/blog/2025/09/15/area-mobius-transformation/) - The image of the unit disk under a Möbius transformation is another disk (if there's no singularity inside the disk). What is the area of that disk? - [Circles and lines under a Möbius transformation](https://www.johndcook.com/blog/2022/06/26/mobius-transformation-circles/) - Given an equation of a line or circle, what is the equation of its image under a Möbius transformation? - [More triangle inequalities](https://www.johndcook.com/blog/2025/09/12/more-triangle-inequalities/) - Four more triangle inequalities analogous to Erdős inequality. - [Area of unit disk under a univalent function](https://www.johndcook.com/blog/2025/09/12/conformal-image-area/) - If f is a conformal map of the unit disk D, the area of f(D) has a simple expression in terms of the power series coefficients of f. - [Minimalist Mandelbrot set](https://www.johndcook.com/blog/2025/09/04/minimalist-mandelbrot-set/) - The Mandelbrot set is complicated, but to first approximation it has two parts: a cardioid and a disk. - [Random samples from a polygon](https://www.johndcook.com/blog/2025/09/11/random-samples-from-a-polygon/) - Algorithm for random sampling from a polygon. The polygon does not have to be regular, though things are easier if the polygon is convex. - [A triangle inequality by Erdős](https://www.johndcook.com/blog/2025/09/11/a-triangle-inequality-by-erdos/) - A triangle inequality conjectured by Erdős inn 1935 and proved by Mordell and Barrow in 1937. - [New symbols in Unicode 17](https://www.johndcook.com/blog/2025/09/10/new-symbols-in-unicode-17/) - Some of the symbols added to Unicode in version 17: The new Saudi riyal symbol, equal sign with infinity on top, symbols for asteriods - [Randomize, then humanize](https://www.johndcook.com/blog/2023/12/29/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 - [Mandelbrot and Fat Tails](https://www.johndcook.com/blog/2025/09/09/mandelbrot-fat-tails/) - The Mandelbrot set is the set of complex numbers c such that iterations of f(z) = z² + c remain bounded. But how do you know an iteration will remain bounded? You know when it becomes unbounded—if |z| > 2 then the point isn't coming back—but how do you know whether an iteration will never become unbounded? You - [Mandelbrot area and escape times](https://www.johndcook.com/blog/2025/09/08/mandelbrot-area-and-escape-times/) - Looking at the escape times for points that are not part of the Mandelbrot set. Using these times to estimate the area of the Mandelbrot set. - [Inferring sample size from confidence interval](https://www.johndcook.com/blog/2025/09/08/inferring-sample-size/) - How to reverse engineer an unreported sample size if you're given a proportion estimate and a confidence interval. - [Mandelbrot points of every period](https://www.johndcook.com/blog/2025/09/05/mandelbrot-bulbs/) - For every positive integer q there are bulbs attached to the main cardioid of the Mandelbrot set that correspond to cycles of length q. - [Measuring cryptographic strength in liters of boiling water](https://www.johndcook.com/blog/2025/09/02/cryptographic-strength/) - Illustrating the strength of encryption by the amount of energy it would take to break and how much water that energy could boil. - [How quantum computing would affect Bitcoin](https://www.johndcook.com/blog/2025/08/30/quantum-bitcoin/) - There is an asymmetry between sending and receiving Bitcoin that has important consequences if and when quantum computing becomes practical. - [Impossible rational triangles](https://www.johndcook.com/blog/2025/09/02/impossible-rational-triangles/) - Are there integers a and b such that no rational triangle can have sides of length a and b? - [Trigamma](https://www.johndcook.com/blog/2025/09/01/trigamma/) - What the trigamma function is and a useful series for computing it. - [Vanity addresses](https://www.johndcook.com/blog/2025/09/01/vanity-addresses/) - Bitcoin addresses are essentially hash values of public keys encoded in Base58. More details here. The addresses are essentially random characters chosen from the Base58 alphabet: uppercase and lowercase Latin letters and digits, with 0 (zero), I (capital I), O (capital O), and l (lowercase l) removed to prevent errors. You could create an address - [Computer processes, human processes, and scalability](https://www.johndcook.com/blog/2008/07/15/computer-processes-human-processes-and-scalability/) - Jeff Atwood had a good post today about database normalization and denormalization recently. A secondary theme of his post is scalability, how well software performs as inputs increase. A lot of software developers worry too much about scalability, or they worry about the wrong kind of scalability. In my career, scalability of computer processes has - [C# random number generation code](https://www.johndcook.com/blog/2010/05/03/c-random-number-generation-code/) - This weekend Code Project posted an updated version of my Code Project article Simple Random Number Generation. The article comes with C# source code for generating random samples from the following distributions. Cauchy Chi square Exponential Inverse gamma Laplace (double exponential) Normal Student t Uniform Weibull After I submitted the revised article I realized I - [Calling C++ from R](https://www.johndcook.com/blog/2011/06/30/calling-cpp-from-r/) - This post relates my experience with calling C++ from R by writing an R module from scratch and by the inline module. The most reliable way to speed up R code is to take it out of R. I've looked at various tricks for speeding up R code and none have improved the performance of - [Computing skewness and kurtosis in one pass](https://www.johndcook.com/blog/2013/06/11/computing-skewness-and-kurtosis-in-one-pass/) - If you compute the standard deviation of a data set by directly implementing the definition, you'll need to pass through the data twice: once to find the mean, then a second time to accumulate the squared differences from the mean. But there is an equivalent algorithm that requires only one pass and that is more - [Scientific papers: innovation ... or imitation?](https://www.johndcook.com/blog/2025/06/05/scientific-papers-innovation-or-imitation/) - Reactions to pioneering scientific publications often focus only on the small details of the discovery. We would do better by looking at the bigger picture. - [Reproducible randomized controlled trials](https://www.johndcook.com/blog/2016/02/01/reproducible-randomized-controlled-trials/) - If you use the current time to seed your random number generator, then the time effective IS your generator, and that's not reproducible. - [Cyclic permutations and trace](https://www.johndcook.com/blog/2021/05/10/cyclic-permutations-and-trace/) - The trace of the product of several matrices is the same for some permutations of the product and not for others. - [Balanced tournament designs](https://www.johndcook.com/blog/2022/09/17/balanced-tournament-designs/) - Designing a round robin tournament so that every team plays each round, and no team plays more than twice in the same location. - [Uniformitarian vs Paretoist](https://www.johndcook.com/blog/2014/11/16/uniformitarian-or-paretoist/) - A uniformitarian view is that everything is equally important. For example, there are 118 elements in the periodic table, so all 118 are equally important to know about. The Pareto principle would say that importance is usually very unevenly distributed. The universe is essentially hydrogen and helium, with a few other elements sprinkled in. From - [Permutable polynomials](https://www.johndcook.com/blog/2020/08/22/permutable-polynomials/) - Polynomials p and q are permutable if p(q(x)) = q(p(x)). The Chebyshev polynomials are essentially the only nontrivial sequence of permutable polynomials. - [Benefits of redundant coordinates](https://www.johndcook.com/blog/2019/12/11/redundant-coordinates/) - Sometimes adding an extra coordinate that isn't strictly necessary can make things much simpler. - [Lemniscate functions](https://www.johndcook.com/blog/2023/10/04/lemniscate-functions/) - The lemniscate functions are the analogs of sine and cosine on a figure eight rather than on a circle. - [A gentle introduction to QMC and discrepancy](https://www.johndcook.com/blog/2021/06/03/qmc-and-discrepancy/) - A sequence that comes up in music provides an introduction to Quasi-Monte Carlo series and their applications. - [How many ways can you triangulate a regular polygon?](https://www.johndcook.com/blog/2025/04/16/triangulate-polygon/) - How many ways can you partition a regular polygon? What if you count rotations of the same partition as the same? What if you count reflectios as the same - [The world is lumpy](https://www.johndcook.com/blog/2022/11/01/the-world-is-lumpy/) - The most important things are more important than we realize. Illustration from Japanese character frequency. - [Memorable Primes](https://www.johndcook.com/blog/2025/08/11/memorable-primes/) - Memorable prime numbers with various numbers of digits. For example, if you need a five-digit prime, you could say 18181. - [Google Adiantum and the ChaCha RNG](https://www.johndcook.com/blog/2019/03/02/chacha-adiantum/) - Google is using the ChaCha cryptographic RNG in a stream cipher for encrypting Android devices not powerful enough to use AES. - [Squircle perimeter and the isoparametric problem](https://www.johndcook.com/blog/2019/04/11/dido-problem/) - For a fixed perimeter, the shape with the maximum area is a circle. For squircles with fixed axes, what exponent maximizes the ratio of area to perimeter? - [Estimating vocabulary size with Heaps' law](https://www.johndcook.com/blog/2019/08/27/heaps-law/) - Heaps' law says that vocabulary of a text is typically a power law function of the total number of words. We test this using the books of the Bible. - [Golden ratio base numbers](https://www.johndcook.com/blog/2025/06/08/phinary/) - Positional number systems typically have a integer base, but irrational and even complex bases are possible. The golden ratio was the first irrational base. - [Using TF-IDF to pick out important words](https://www.johndcook.com/blog/2025/08/06/tf-idf/) - Explaining the TF-IDF statistic for measuring word importance in a set of documents. Illustrated by applying to the books of the Bible. - [What's in your wallet?](https://www.johndcook.com/blog/2025/08/16/whats-in-your-wallet/) - Cryptocurrency wallets don't CONTAIN crypto. They contain private keys to access crypto, or rather a seed phrase that can generate private keys. - [Recovering a permuted seed phrase](https://www.johndcook.com/blog/2025/08/16/recovering-a-permuted-seed-phrase/) - If you remember the words in a seed phrase out of order, try permutations in order of their permutation distance from what you remember. - [Intuition for Pick's Theorem](https://www.johndcook.com/blog/2025/08/24/intuition-for-picks-theorem/) - Pick's theorem computes the area of a figure drawn on a grid by counting the number of grid points inside and on the perimeter, but the formula isn't obvious. - [You can't have everything you want: beta edition](https://www.johndcook.com/blog/2025/08/26/beta-prior/) - The beta distribution is a conjugate prior for a binomial likelihood function, so it makes posterior probability calculations trivial: you simply add your data to the distribution parameters. If you start with a beta(α, β) prior distribution on a proportion θ, then observe s successes and f failures, the posterior distribution on θ is beta(α + - [An integral theorem of Gauss](https://www.johndcook.com/blog/2025/08/31/an-integral-theorem-of-gauss/) - Gauss proved in 1818 that the value of integral is unchanged if x and y are replaced by (x + y)/2 and √(xy), i.e. if you replaced x and y with their arithmetic mean and geometric mean [1]. So, for example, if you wanted to compute you could instead compute Notice that the coefficients of sin² θ and cos² θ - [Probability of typing a wrong Bitcoin address](https://www.johndcook.com/blog/2025/08/28/wrong-address/) - How likely is it that a mistyped Bitcoin address is a valid address? How likely is it that some address is a plausible typo of another? - [El Salvador's Bitcoin and Quantum Computing](https://www.johndcook.com/blog/2025/08/30/el-salvador-bitcoin/) - El Salvador just divided its reserve of over 6,000 BTC into 14 wallets. What this has to do with protection from quantum computing attacks. - [Storing data in images](https://www.johndcook.com/blog/2025/08/29/data-in-images/) - QR codes and other ways of storing data in images - [An uncrossed knight's tour](https://www.johndcook.com/blog/2025/08/29/an-uncrossed-knights-tour/) - How long a tour can a knight make on a chessboard without crossing his path? - [A knight's tour magic square](https://www.johndcook.com/blog/2011/04/06/a-knights-magic-square/) - This magic square was created by Leonhard Euler William Beverley, Each row and each column sum to 260. Each half-row and half-column sum to 130. The square is also a knight's tour: a knight could visit each square on a chessboard exactly once by following the numbers in sequence. Here is Python code to verify that - [Dithered QR codes](https://www.johndcook.com/blog/2025/08/28/dithered-qr-codes/) - I saw a post by Dave Richeson on Mastodon about making QR codes that look like images. Turns out you can shrink a black square in a QR code by up to a factor of three while keeping the code usable. This gives you the wiggle room to create dithered images. I tried a few - [Why are CUDA kernels hard to optimize?](https://www.johndcook.com/blog/2025/08/27/why-are-cuda-kernels-hard-to-optimize/) - AI-generated GPU kernels are a popular topic. We examine difficulties of optimizing code for GPUs and challenges in general-purpose optimized GPU libraries. - [The biggest math symbol](https://www.johndcook.com/blog/2025/08/27/the-biggest-math-symbol/) - Riemann's P-symbol is an intriguing/intimidating piece of notation. It denotes a solution to a very important class of differential equations. - [More on seed phrase words](https://www.johndcook.com/blog/2025/08/26/seed-phrase-words-2/) - More thoughts about crypto wallet seed phrase words: unique prefixes, word frequency, vocabulary estimation and overlap - [Variations on Knuth's Twindragon](https://www.johndcook.com/blog/2025/08/25/variations-on-knuths-twindragon/) - Variations on Knuth's twindragon fractal by rotating the base. - [A simple way to generate random points on a sphere](https://www.johndcook.com/blog/2025/05/06/random-points-on-a-sphere/) - A way of generating points on a sphere that is intuitively clear and efficient. Comparison to the more common algorithm. - [What's hierarchical about a hierarchical wallet?](https://www.johndcook.com/blog/2025/08/23/hd-wallets/) - The new style of crypto wallets is HD for hierarchical deterministic. What is hierarchical and what is deterministic about such wallets - [Randomly generated dragon](https://www.johndcook.com/blog/2025/08/16/randomly-generated-dragon/) - A simple random process that produces the Twin Dragon fractal. - [A recipe for creating random fractals](https://www.johndcook.com/blog/2025/08/21/random-fractals/) - A general recipe for creating randomly-generated fractals that tile the plane. - [Knuth's Twindragon](https://www.johndcook.com/blog/2025/08/23/knuths-twindragon/) - Knuth defines the twindragon fractal to be the set of complex numbers that are "fractions" in base 1-i. Implemented in Python code. - [Punch Cards and Dollar Bills](https://www.johndcook.com/blog/2025/08/22/punch-card-dollar/) - The size of a punch card was standardized to be the size of US bank notes at the time. Since then the dollar has shrunk, literally and figuratively. - [When log(x) has the same digits as x](https://www.johndcook.com/blog/2025/08/20/x-logx-same-digits/) - When does log x equal x with the decimal place moved? First we look at the problem for base 10, then for more general bases. - [Factoring Stencils](https://www.johndcook.com/blog/2025/08/17/factoring-stencils/) - An ingenious device for factoring integers from the days before computers. A set of around 300 stencils could factor 9-digit numbers. - [Connecting partial sums](https://www.johndcook.com/blog/2025/08/19/connecting-partial-sums/) - Creating interesting images by connecting the partial sums of a series involving the exponential of complex numbers. - [A lot of seed phrase words are similar](https://www.johndcook.com/blog/2025/08/18/seed-phrase-words/) - The list of words used to backup Bitcoin wallets contains a lot of pairs that can easily be confused. Around 800 pairs of words differ by only one character. - [Converting very long strings to integers in Python](https://www.johndcook.com/blog/2025/08/15/very-long-string-to-int/) - Python integers can be arbitrarily long, but there are limits on the size of string that you can convert to an integer. How to get around this limit. - [Uppercase Eszett](https://www.johndcook.com/blog/2025/08/14/uppercase-eszett/) - The German letter that looks kinda like a Greek beta is eszett. How its capitalization leads to software difficulties. - [Weierstrass, Montgomery, and Edwards elliptic curve forms](https://www.johndcook.com/blog/2025/08/13/weierstrass-montgomery-edwards/) - Converting elliptic curves between Weierstrass, Montgomery, and twisted Edwards form. Using Baby Jubjub and Tiny Jubjub as examples. - [Tiny Jubjub](https://www.johndcook.com/blog/2025/08/13/tiny-jubjub/) - The Tiny Jubjub curve is an elliiptic curve designed to be similar to other Jubjub curves, but small enough for hand calculations. - [Two ways of generalizing π](https://www.johndcook.com/blog/2025/08/12/generalizing-pi/) - Pi is the ratio of a circle's circumference to its diameter. You can generalize pi to pi_p by generalizing the notion of circle and the notion of circumference. - [Misleading plots of elliptic curves](https://www.johndcook.com/blog/2025/08/11/misleading-plots-of-elliptic-curves/) - Plotting the points on an elliptic curve over a finite field can be very misleading. - [The Rise and Fall of Bayesian Statistics](https://www.johndcook.com/blog/2025/08/08/the-rise-and-fall-of-bayesian-statistics/) - Bayesian statistics has gone from déclassé to prestigious to ho-hum. It's odd that a mathematical technique ever stirred such strong feelings one way or the other. - [Self-loathing AI](https://www.johndcook.com/blog/2025/08/08/self-loathing-ai/) - Google Gemini meltdowns. "I am a disgrace to all possible and impossible universes and all that is not a universe." - [Counting points on an elliptic curve](https://www.johndcook.com/blog/2025/08/07/elliptic-curve-trace/) - Counting the number of points on an elliptic curve using a crude algorithm, a better algorithm, and the best algorithm. - [Genesis Block Easter Egg](https://www.johndcook.com/blog/2025/08/06/genesis-block/) - Easter Egg from the whitepaper "Strengthening American Leadership in Digital Financial Technology" with hex dump of the Bitcoin Genesis Block. - [Making the two-dimensional one-dimensional](https://www.johndcook.com/blog/2025/08/06/making-2d-1d/) - We often want to reduce something that's inherently two-dimensional into something one-dimensional. We want to turn graph into a list. And we'd like to do this with some kind of faithfulness. We'd like things that are close together in 2D space to be close together in their 1D representation, and vice versa, to the extent - [Overview of NIST post-quantum encryption finalists](https://www.johndcook.com/blog/2020/07/23/nist-pqc-finalists/) - Overview of the public key encryption and digital signature algorithms selected by NIST for the third round of their post-quantum encryption contest. - [Time to factor big integers Python and Mathematica](https://www.johndcook.com/blog/2025/08/04/factorization-sympy-mathematica/) - Testing the time to factor big integers in Python with SymPy compared to Matheamtica - [Roundest regular solid](https://www.johndcook.com/blog/2025/07/31/roundest-regular-solid/) - A dodecahedron is rounder than an icosahedron, as measured by angle defect, the discrete analog of curvature. - [Cycles of Elliptic Curves](https://www.johndcook.com/blog/2025/08/02/cycles-of-elliptic-curves/) - Cycles of ellptic curves have the property that the number of points on one curve equals the field size of the next curve. - [Probability of secure hash collisions](https://www.johndcook.com/blog/2017/01/10/probability-of-secure-hash-collisions/) - About how many items can you expect to hash with a secure hash function before risking into collisions? Here's a rule of thumb and a proof. - [Numerical methods blog posts](https://www.johndcook.com/blog/2018/12/10/numerical-methods/) - List of blog posts on numerical methods, and why I haven't written much about differential equations even thought I started out working in that area. - [IronPython article on CodeProject](https://www.johndcook.com/blog/2009/03/11/ironpython-codeproject/) - It's difficult to use SciPy from IronPython because much of SciPy is implemented in C rather than in Python itself. I wrote an article on Code Project summarizing some things I'd learned about using Python modules with IronPython. (Many thanks to folks who left helpful comments here and answered my questions on StackOverflow.) The article - [Pitfalls in random number generation](https://www.johndcook.com/blog/2008/08/14/pitfalls-in-random-number-generation/) - I published an article on CodeProject this week about some of the traps you can fall into when using random number generators. Pitfalls in Random Number Generation (link went away) - [IronPython is a one-way gate](https://www.johndcook.com/blog/2009/02/26/ironpython-is-a-one-way-gate/) - IronPython opens up the world of .NET to Python programmers. It's not as good yet at opening up the world of Python to .NET programmers. It is easy to write .NET applications in IronPython. I typed in some sample code within a few minutes of installing IronPython and made a very simple Windows application. But - [Product of Chebyshev polynomials](https://www.johndcook.com/blog/2020/03/15/product-of-chebyshev-polynomials/) - The product of the mth and nth Chebyshev polynomials is the average of the (m + n)th and (m – n)th Chebyshev polynomials. - [Three proofs that 2017 is prime](https://www.johndcook.com/blog/2017/01/09/three-proofs-that-2017-is-prime/) - Aaron Meurer asked on Twitter whether there's a proof that 2017 is prime that would fit into 140 characters. My first reply was this: sqrt(2017) < 45. 2017 not divisible by 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, or 43. Ergo prime. I'm not sure that's what he had - [Seven dogmas of category theory](https://www.johndcook.com/blog/2013/06/06/seven-dogmas-of-category-theory/) - Joseph Goguen gave seven dogmas in his paper A Categorical Manifesto. To each species of mathematical structure, there corresponds a category whose objects have that structure, and whose morphisms preserve it. To any natural construction on structures of one species, yielding structures of another species, there corresponds a functor from the category of the first - [Houston's long term planning](https://www.johndcook.com/blog/2025/06/02/houstons-long-term-planning/) - Houston's outer loop was proposed over 60 years ago and is still under construction. - [Searching for proper nouns](https://www.johndcook.com/blog/2023/07/17/searching-for-proper-nouns/) - Suppose you want to find all the proper nouns in a document. You could grep for every word that starts with a capital letter with something like grep '\b[A-Z]\w+' but this would return the first word of each sentence in addition to the words you're after. You could grep for capitalized words that are not - [Summarizing homotopy groups of spheres](https://www.johndcook.com/blog/2018/07/20/homotopy-groups-of-spheres/) - I don't understand homotopy groups of spheres, and it's OK if you don't either. Nobody fully understands them. This post is really more about information compression than homotopy. That is, I'll be looking at ways to summarize what is known without being overly concerned about what the results mean. The task: map two integers to - [Python code for octonion and sedenion multiplication](https://www.johndcook.com/blog/2018/07/09/octonioin-multiplication/) - Python code that multiplies quaternions, then bootstraps this to multiply octonioins, then bootstaps that to multiply sedenions. - [Hebrew letters spotted in applied math](https://www.johndcook.com/blog/2021/06/23/hebrew-letters-in-math/) - Hebrew letters are rare in math, especially past the first four letters, and especially outside set theory. But there are exceptions. - [Transmission Obstacles and Ellipsoids](https://www.johndcook.com/blog/2025/07/05/fresnel-ellipsoids/) - Fresnel ellipsoids are regions of space in which obstacles will cause destructive interference for radio transmission. Post explains why ellipsoids. - [Acoustic roughness](https://www.johndcook.com/blog/2016/03/30/acoustic-roughness/) - When you add two pure tones, you hear different effects depending on how far apart the frequencies of the two tones are. - [Chebyshev polynomials as distorted cosines](https://www.johndcook.com/blog/2024/08/15/distorted-cosines/) - Unpacking Acton's quip that Chebyshev polynomials are cosine curves with a somewhat disturbed horizontal scale. - [Refactored code for division algebras](https://www.johndcook.com/blog/2018/07/10/cayley-dickson/) - Refactoring of code from previous posts. Uses the Cayley-Dickson construction to multiply real, complex, quaternion, and octonion numbers (and more). - [Comparing range and precision of IEEE and posit](https://www.johndcook.com/blog/2018/04/14/ieee-vs-posit/) - Comparing the dynamic range and precision of IEEE floating point numbers of various size (half precision up to double precision) with their posit number counterparts. - [Hom functors and a glimpse of Yoneda](https://www.johndcook.com/blog/2018/08/06/hom-functors/) - What does Hom mean? Why is it called that? How can it be a set and a functor? This post explains, and gives a mnemonic for remembering common notation. - [Powers of 3 + √2](https://www.johndcook.com/blog/2025/07/18/powers-of-3-sqrt2/) - How to calculate large powers of 3 + √2 numerically with bc and symbolically with Mathematica. Conjecture regarding the integer and irrational parts. - [Base58Check encoding in Python](https://www.johndcook.com/blog/2025/07/30/base58check-python/) - Going through the steps of computing Base58Check encoding in Python. Getting the hash and base58 encoding syntax correct. - [Finding tangent circles](https://www.johndcook.com/blog/2025/07/31/finding-tangent-circles/) - Given three mutually tangent circles, there is an elegant theorem for finding two more circles tangent to all three. - [Machine learning by satisfiability solving](https://www.johndcook.com/blog/2025/07/31/machine-learning-by-satisfiability-solving/) - Automated reasoning tools like SAT and SMT solvers might seem an unlikely choice for machine learning. However for some cases they can be quite effective. - [Primitive Pythagorean triangles with the same area](https://www.johndcook.com/blog/2025/07/30/pythagorean-triangles/) - You can find three primitive Pythagorean triangles with the same area, but what about four? - [Base58 versus Base85 encoding](https://www.johndcook.com/blog/2025/07/23/base58-base85/) - Base58 and Base85 can easily be confused and they differ in subtle ways. - [Most legible font for WIF](https://www.johndcook.com/blog/2025/07/30/wallet-wif-font/) - Wallet Import Format (WIF) is Base58 encoded, which removes some easily confused symbols like 0 and O. The best font for distinguishing the rest of the symbols. - [Counting sums of squares](https://www.johndcook.com/blog/2025/07/29/counting-sums-of-squares/) - For large N, about what proportion of numbers less than N are the sum of two squares - [Eigenvalues of the Laplacian on a square](https://www.johndcook.com/blog/2025/07/29/laplace-square/) - Finding and ordering the eigenvalues of the Laplace operator on the unit square with zero boundary conditions. - [The sound of drums that tile the plane](https://www.johndcook.com/blog/2025/07/29/drums-tiling-the-plane/) - Bounds on the frequencies of a vibrating membrane, provided its shape can tile the plane. - [Moessner's Magic](https://www.johndcook.com/blog/2025/07/29/moessners-magic/) - Moessner's Magic is a generalization of an ancient theorem that wasn't discovered until 1951. - [Equivalence between commonly used elliptic curves](https://www.johndcook.com/blog/2025/07/28/equivalent-curves/) - The elliptic curves Ed25519 and Curve25519 are both used in cryptography, and are equivalent in one sense and not in another. - [Monero's elliptic curve](https://www.johndcook.com/blog/2025/07/27/moneros-elliptic-curve/) - Exploring the elliptic curve used in Monero for digital signatures. Making explicit some things that are often left implicit. - [Retrofitting error detection](https://www.johndcook.com/blog/2025/07/27/retrofitting-error-detection/) - What can you do if you didn't include a check sum in an identifier then decide you want to go back and add one but don't want to break old IDs? - [Bitcoin key mechanism and elliptic curves over finite fields](https://www.johndcook.com/blog/2018/08/14/bitcoin-elliptic-curves/) - The Bitcoin key mechanism is based on elliptic curve cryptography over a finite field. This post gives a brief overview. - [Analogs of binomial coefficients](https://www.johndcook.com/blog/2025/07/24/analogs-of-binomial-coefficients/) - Numbers like binomial coefficients satisfy identities like Pascal's triangle. - [A bank note with 21 implicit zeros](https://www.johndcook.com/blog/2025/07/25/sextillion/) - Bank notes in denominations of trillions, quintillions, and sextillions. - [Taylor Series and the Argentine Peso](https://www.johndcook.com/blog/2025/07/25/argentine-peso/) - Present value approximation that implicitly assumes moderate interest rates gives absurd results when applied at high interest rates. - [Annuity and factorial notation](https://www.johndcook.com/blog/2025/07/24/annuity-and-factorial-notation/) - Two uses of bracket notation: actuarial symbols related to annuities and an obsolete notation for factorial - [Hyperinflation changes everything](https://www.johndcook.com/blog/2025/07/20/hyperinflation/) - Financial calculations involve implicit assumptions that go out the window under hyperinflation. - [Interest compounding with every heartbeat](https://www.johndcook.com/blog/2025/07/20/continuous-interest/) - How frequently do you have to compound interest before compounding it more often makes no difference - [Numerical problem with an interest calculation](https://www.johndcook.com/blog/2025/07/20/interest-tech-note/) - A numerical issue causes an incorrect conclusion, implying that compounding interest more often results in less interest. How to fix it. - [Multiples and powers mod 1](https://www.johndcook.com/blog/2025/07/17/multiples-and-powers-mod-1/) - For any x, the behavior of multiples of x mod 1 is easy to classify. The powers of x mod 1 are more interesting. We give examples of different behavior. - [Evaluating and lowering AI hallucination cost](https://www.johndcook.com/blog/2025/07/16/hallucination-cost/) - AI models hallucinate, and always will [1]. In some sense this is nothing new: everything has an error rate. But what is new is the nature of AI errors. The output of an AI is plausible by construction [2], and so errors can look reasonable even when they're wrong. For example, if you ask for - [A Continental Divide for Newton's Method](https://www.johndcook.com/blog/2025/07/14/continental-divide/) - Using Newton's method to soive for the roots of a quadratic equation, there's a sort of "continental divide" separating the plane into two basins of attraction. - [Experiences with Nvidia](https://www.johndcook.com/blog/2025/07/09/experiences-with-nvidia/) - Nvidia is the world's largest company by market cap. Here are some thoughts based on personal observation about what makes Nvidia distinctive. - [All pieces on a small chessboard](https://www.johndcook.com/blog/2025/07/13/all-pieces-on-a-small-chessboard/) - Place all eight pieces on a 6 by 5 chessboard so that the bishops are on opposite colored squares and no piece is attacking another. - [What good is a DE once you have the solution?](https://www.johndcook.com/blog/2023/07/04/useful-de/) - Sometimes its useful to work backward from a function to a differential equation it solves. The DE can help you learn things about the function. - [Quadruple factorials and Legendre functions](https://www.johndcook.com/blog/2021/10/18/quadruple-factorial-legendre-functions/) - Quadruple factorials arise naturally, for example, when evaluating Legendre functions. - [Legendre polynomials](https://www.johndcook.com/blog/2025/07/07/legendre-polynomials/) - Introduction to Legendre polynomials. How they're defined. How they're used. - [The biggest perturbation of satellite orbits](https://www.johndcook.com/blog/2025/07/07/j2-effect/) - The most important factor left out of the two body problem is the J2 effect, due to the fact that the earth is not a sphere of uniform density. - [Fitting a parabola to an ellipse and vice versa](https://www.johndcook.com/blog/2025/06/01/parabola-ellipse/) - Fitting a parabola to an ellipse, and fitting ellipses to a parabola - [Fast approximation of beta inequalities](https://www.johndcook.com/blog/2012/10/15/beta-inequalities/) - A beta distribution has an approximate normal shape if its parameters are large, and so you could use normal approximations to compute beta inequalities. The corresponding normal inequalities can be computed in closed form. This works surprisingly well. Even when the beta parameters are small and the normal approximation is a bad fit, the corresponding - [Probability function names](https://www.johndcook.com/blog/2012/07/02/probability-function-names/) - For a random variable X and a particular value x, one often needs to compute the probabilities Pr(X ≤ x) and Pr(X > x). It's surprising how many different approaches software packages take to naming these two functions. I'll give a few examples here. It may seem unnecessary to provide software for computing both probabilities - [Just what do you mean by "number"?](https://www.johndcook.com/blog/2012/04/18/just-what-do-you-mean-by-number/) - Tom Christiansen gave an awesome answer to the question of how to match a number with a regular expression. He begins by clarifying what the reader means by "number", then gives answers for each. Is −0 a number? How do you feel about √−1? Is ⅝ or ⅔ a number? Is 186,282.42±0.02 miles/second one number - [Finding a vector potential whose curl is given](https://www.johndcook.com/blog/2022/12/03/vector-potential/) - Given a vector field F with zero divergence, find a vector potential whose curl equals F. - [Conformal map of rectangle to ellipse](https://www.johndcook.com/blog/2022/12/08/conformal-rectangle-to-ellipse/) - The sine function gives a conformal map from a rectangle to an ellipse minus a slit - [Probability problem with Pratt prime proofs](https://www.johndcook.com/blog/2023/01/19/pratt-probability/) - When creating a Pratt primality certificate, how many bases might you have to try before you find one that will work? - [Van Aubel's theorem](https://www.johndcook.com/blog/2023/01/23/van-aubels-theorem/) - Van Aubel's theorem is analogous to Napoleon's theorem in that a figure created from a non-symmetric figure has surprising symmetry. - [The Million Dollar Matrix Multiply](https://www.johndcook.com/blog/2024/01/03/the-million-dollar-matrix-multiply/) - More efficient matrix multiplication algorithms could save millions of dollars on computationally intense tasks such as training LLMs. - [Normal subgroups are subtle](https://www.johndcook.com/blog/2024/03/05/normal-subgroups-2/) - The definition of a subgroup is obvious, but the definition of a normal subgroup is subtle. An alternate definition and generalizations to category theory. - [Finding embarrassing and unhelpful error messages](https://www.johndcook.com/blog/2009/10/07/finding-embarrassing-and-unhelpful-error-messages/) - Every time your software displays an error message, you risk losing credibility with your users. If the message is grammatically incorrect, your credibility definitely goes down a notch. And if the message is unhelpful, your credibility goes down at least one more notch. The same can be said for any message, but error messages are - [Root-finding software in C#](https://www.johndcook.com/blog/2010/05/06/root-finding-software-in-c/) - Code Project just posted my article Three Methods for Root-finding in C# (link went away). The article discusses the pros and cons of bisection, Newton's method, and Brent's method and gives C# implementations of each. Related posts C# random number generation code Free C# book Floating point numbers are a leaky abstraction - [Ruby, Python, and Science](https://www.johndcook.com/blog/2010/11/28/ruby-python-and-science/) - David Jacobs has written a long blog post Ruby is beautiful (but I'm moving to Python). [Update: link no longer available.] Here's my summary. Ruby is much better than Java, but the Ruby community is too focused on web development and the language has no scientific library. Python has a lot of the same advantages - [Five interesting things about Mersenne primes](https://www.johndcook.com/blog/2011/09/09/five-interesting-things-about-mersenne-primes/) - A Mersenne prime is a prime number that is one less than a power of 2. These primes are indexed by the corresponding power of two, i.e. Mp = 2p − 1. It turns out p must be prime before 2p − 1 can be prime. Here are five things I find interesting about Mersenne - [Twenty questions and conditional probability](https://www.johndcook.com/blog/2017/11/16/twenty-questions-and-conditional-probability/) - The previous post compared bits of information to answers in a game of Twenty Questions. The optimal strategy for playing Twenty Questions is for each question to split the remaining possibilities in half. There are a couple ways to justify this strategy: minmax and average. The minmax approach is to minimize the worse thing that - [Why do LLMs have emergent properties?](https://www.johndcook.com/blog/2025/05/08/why-do-llms-have-emergent-properties/) - Large language models show unexpected "emergent" behaviors as they are scaled up. This should not at all be surprising. Here we give a possible explanation. - [Function on cover of Abramowitz & Stegun](https://www.johndcook.com/blog/2017/02/26/function-on-cover-of-abramowitz-stegun/) - What is the function graphed on the cover of Abramowitz and Stegun's Handbook of Mathematical Functions? - [How much can Boolean expressions be simplified?](https://www.johndcook.com/blog/2020/11/19/boolean-expression-compression/) - If you have a Boolean function with n variables, how long can a minimized version of the expression be? How much does minimization save? - [Visualizing complex functions](https://www.johndcook.com/blog/2017/11/09/visualizing-complex-functions/) - The plot of a complex function of a complex argument would take four dimensions to fully visualize. But we can make color an extra dimension. - [Odd parts and distinct parts](https://www.johndcook.com/blog/2021/11/11/odd-parts-and-distinct-parts/) - Illustrating a theorem of Euler using Mathematica. Testing understanding of terms. - [Programming language fatigue](https://www.johndcook.com/blog/2009/04/10/programming-language-fatigue/) - Joe Brinkman wrote an insightful article the other day, Polyglot Programming: Death By A Thousand DSLs. Here's an excerpt: I don’t know about other programmers, but I am drowning in DSLs [domain specific languages]. It is hard enough keeping up with my primary development language and the associated platform APIs, but these DSLs are going - [Partitions and Pentagons](https://www.johndcook.com/blog/2021/11/10/partitions-and-pentagons/) - This post presents Euler's pentagonal number theorem and illustrates it with concrete examples using Mathematica. - [Translating Robert Burns](https://www.johndcook.com/blog/2019/06/18/translating-robert-burns/) - Quantifying the similarity between Robert Burns' poem On a Louse and a translation of the poem into more common English, using Levenshtein distance. - [It's like this other thing except ...](https://www.johndcook.com/blog/2018/04/24/subtractive-definitions/) - One of my complaints about math writing is that definitions are hardly ever subtractive, even if that's how people think of them. For example, a monoid is a group except without inverses. But that's not how you'll see it defined. Instead you'll read that it's a set with an associative binary operation and an identity - [Embeddings, Projections, and Inverses](https://www.johndcook.com/blog/2025/05/14/embed-project-invert/) - Embeddings and projections are not inverses of each other, but they're like inverses. Three generalizations of inverse: left and right, adjoint, & pseudoinverse - [Swedish superellipse](https://www.johndcook.com/blog/2014/06/07/swedish-superellipse/) - The fountain in Sergels torg (English: Sergel's Square) in Stockholm is in the shape of a "superellipse." Piet Hein proposed this shape as a practical and aesthetically pleasing compromise between a circle and a rectangle. What Piet Hein dubbed a superellipse is a curve satisfying In the case of Sergels torg, a/b = 6/5. A - [Gelfand's question](https://www.johndcook.com/blog/2013/06/19/gelfands-question/) - Gelfand's question asks whether there is a positive integer n such that the first digits of jn base 10 are all the same for j = 2, 3, 4, …, 9. (Thanks to @republicofmath for pointing out this problem.) This post will explore Gelfand's question via probability. The MathWorld article on Gelfand's question says that - [Graph Laplacian and other matrices associated with a graph](https://www.johndcook.com/blog/2015/12/02/graph-matrices/) - Several matrices associated with a graph, including variations on the graph Laplacian. - [Iterated logarithm](https://www.johndcook.com/blog/2025/06/04/iterated-logarithm/) - The iterated logarithm comes up occasionally in the analysis of algorithms. It's also useful for giving a compact way to describe unimaginably large numbers. - [Sinc function approximation](https://www.johndcook.com/blog/2025/06/23/sinc-function-approximation/) - A simple approximation to the sinc function, a function that comes up constantly in signal analysis. - [Log-ish](https://www.johndcook.com/blog/2025/06/24/log-ish/) - I saw a post online this morning that recommended the transformation I could see how this could be very handy. Often you want something like a logarithmic scale, not for the exact properties of the logarithm but because it brings big numbers closer in. And for big values of x there's little difference between log(x) and - [Randomized response and local differential privacy](https://www.johndcook.com/blog/2023/11/08/local-dp/) - Local differential privacy randomizes personal data before it is uploaded to a centralized database. Individual privacy does not require trusting the recipient. - [Rectangles to Rectangles](https://www.johndcook.com/blog/2023/12/11/rectangles-to-rectangles/) - An analytic function that maps a rectangle to a rectangle must be a linear polynomial. - [Legendre and Ethereum](https://www.johndcook.com/blog/2025/06/26/legendre-and-ethereum/) - The Legendre symbol is notation for whether a quadratic equation has a solution modulo a prime. What does this have to do with Ethereum proof of custody? - [Test whether a large integer is a square](https://www.johndcook.com/blog/2025/06/26/large-integer-square/) - A short and sweet bit of Python code to test whether an arbitrarily large integer is a square, and to find the floor of the square root. - [Zooming in on a fractalish plot](https://www.johndcook.com/blog/2025/06/29/zooming-in-on-a-fractalish-plot/) - The exponential sum of the day page on my site draws an image every day by plugging the month, day, and year into a formula. Details here. Today's image looks almost solid blue in the middle. The default plotting line width works well for most days. For example, see what the sum of the day - [Most ints are not floats](https://www.johndcook.com/blog/2025/06/27/most-ints-are-not-floats/) - Most numbers that are representable as machine integers are not exactly representable as floating point numbers. - [Tricks for arithmetic modulo NIST primes](https://www.johndcook.com/blog/2019/05/12/nist-primes/) - The primes used in defining NIST elliptic curves have special forms that allow for much faster arithmetic than using general multiprecision arithmetic. - [Checksum polynomials](https://www.johndcook.com/blog/2023/09/06/checksum-polynomials/) - The CRC checksum algorithm essentially computes the remainder modulo a polynomial. This polynomial may or may not be irreducible. - [Patching functions together](https://www.johndcook.com/blog/2025/06/25/patching-functions-together/) - When you patch two functions together, how smooth does the patch need to be? How do you measure smoothness? - [A crowded little chess puzzle](https://www.johndcook.com/blog/2025/05/13/a-crowded-little-chess-puzzle/) - A chess puzzle by Martin Garnder and links to similar articles. - [Uniformity increases entropy](https://www.johndcook.com/blog/2025/06/23/uniformity-increases-entropy/) - Entropy increases as system states become more uniform and decreases as they become further from uniform. - [Maybe it's just hard](https://www.johndcook.com/blog/2019/06/19/maybe-its-just-hard/) - If someone tells you repeatedly that something isn't hard, maybe it's just hard. Examples from monads, regular expressions, and Unicode. - [Arithmetic for fun and profit](https://www.johndcook.com/blog/2025/06/22/division/) - Sometimes the solution to a complicated problem is remarkably simple. - [Why use hash puzzles for proof-of-work?](https://www.johndcook.com/blog/2025/06/22/why-hash-puzzles/) - Why do cryptocurrencies use hash-based puzzles to demonstrate proof-of-work? Why not some more intrinsically useful problem? - [What is proof-of-work?](https://www.johndcook.com/blog/2018/11/11/proof-of-work/) - The idea of proof-of-work is to ask someone to solve a puzzle that demonstrates their willingness to pay a price without actually collecting payment. - [Golden hospital gowns](https://www.johndcook.com/blog/2024/12/16/golden-hospital-gowns/) - A golden hospital gown is an allusion to The Emperor's New Clothes, except the emperor is not entirely clothed nor entirely naked. - [What is the Bitcoin proof-of-work problem?](https://www.johndcook.com/blog/2025/06/20/bitcoin-proof-of-work/) - In order to add a block to the Bitcoin blockchain, miners must solve a puzzle to demonstrate proof of work. What exactly is that puzzle? - [Base 58 encoding and Bitcoin addresses](https://www.johndcook.com/blog/2019/03/04/base-58-encoding-and-bitcoin-addresses/) - Bitcoin addresses ar writen in Base58, a way to express long numbers compactly with letters and digits, omitting characters that are easily confused. - [Minimizing relative error](https://www.johndcook.com/blog/2018/03/07/minimizing-relative-error/) - If you know that a number lies between a and b, how to you guess the number so as to minimize the worst possible relative error? - [Galileo's polygon theorem](https://www.johndcook.com/blog/2020/12/28/galileos-polygon-theorem/) - Galileo's theorem relating the area of a polygon, an inscribed circle, and a similar polygon with the same perimeter as the circle. - [Minimize squared relative error](https://www.johndcook.com/blog/2025/06/21/minimize-squared-relative-error/) - How to choose an estimate that minimizes the squared relative errors to each of the data points. The "relative" requirement is what makes this interesting. - [How much does it matter if the measuring tape sags?](https://www.johndcook.com/blog/2020/09/26/sagging-tape-measure/) - If you run a measuring tape between two points but it sags a little in the middle, how much does the sag increase the length you measure? - [Deleting vs Replacing Names](https://www.johndcook.com/blog/2025/06/19/synthetic-names/) - When deidentifying sensitive data, is it better to remove names or to replace them with randomly generated names? - [Typesetting Sha and Bitcoin](https://www.johndcook.com/blog/2025/06/18/typesetting-sha-and-bitcoin/) - In LaTeX, how to insert the Russian letter Sha (Ш, U+0248) and the currency symbol for Bitcoin (₿, U+20BF). - [Golden powers revisited](https://www.johndcook.com/blog/2025/06/10/golden-powers-revisited/) - Powers of the golden ratio are nearly integers. This post explains why. Also, these integers are the sum of two Fibonacci numbers. - [Divisibility rules in hex](https://www.johndcook.com/blog/2010/10/31/hexadecimal/) - We all learn in elementary school that a number is divisible by 2 if the last digit is even. A number is divisible by 3 if the sum of the digits is divisible by 3. A number is divisible by 5 if its last digit is 0 or 5. Etc. But imagine we were born - [Hashing names does not protect privacy](https://www.johndcook.com/blog/2019/07/20/hashing-pii-does-not-protect-privacy/) - It's trivial to reverse cryptographic hash functions if you know the input consists of names, social security numbers, etc. from a limited set of possible values. - [The quality of an RNG depends on the application](https://www.johndcook.com/blog/2022/06/23/rng-quality/) - Example of an RNG that does really well in one application and fails terribly in another. - [Hallucinations of AI Science Models](https://www.johndcook.com/blog/2024/03/26/hallucinations-of-ai-science-models/) - AI methods already make great impacts on scientific discovery. But questions of reliability and trustworthiness remain. Here we discuss the mathematical issues. - [Probabilistic Identifiers in CCPA](https://www.johndcook.com/blog/2019/02/04/probabilisitic-identifiers-in-ccpa/) - The California Consumer Privacy Act of 2018 defines "probabilistic identifiers." What are they? What is their significance? We'll take a look. - [How fast can you multiply matrices?](https://www.johndcook.com/blog/2018/08/31/how-fast-can-you-multiply-matrices/) - It seems it should take on the order of n cubed operations to multiply two matrices of size n, but it's possible to do better. - [Convex function of diagonals and eigenvalues](https://www.johndcook.com/blog/2020/06/18/convex-function-eigenvalues/) - A well known equality for linear functions of matrix elements extends to an inequality for convex functions. - [Gaussian elimination](https://www.johndcook.com/blog/2022/07/15/gaussian-elimination/) - Gaussian elimination is simple in some sense, but complex and difficult from a more advanced perspective. - [Dot, cross, and quaternion products](https://www.johndcook.com/blog/2012/02/15/dot-cross-and-quaternion-products/) - This post will show that quaternion product = cross product − dot product. First, I'll explain what quaternions are, then I'll explain what the equation above means. The complex numbers are formed by adding to the real numbers a special symbol i with the rule that i2 = −1. The quaternions are similarly formed by - [Normal and non-normal subgroups](https://www.johndcook.com/blog/2023/09/26/normal-and-non-normal-subgroups/) - Group theory focuses on normal subgroups. What's lacking in non-normal subgroups? A very simple, concrete example. - [Big aggregate queries can still violate privacy](https://www.johndcook.com/blog/2017/11/11/aggregate-queries-and-privacy/) - Suppose you want to protect customer privacy by only allowing queries that return aggregate statistics on large groups. That's not enough. - [Asymptotic solution to ODE](https://www.johndcook.com/blog/2018/03/19/asymptotic-solution-to-ode/) - Simple example of an asymptotic series solution for an ordinary differential equation - [The exception case is normal](https://www.johndcook.com/blog/2021/12/27/the-exception-case-is-normal/) - The power series for most trig functions require Bernoulli numbers. Sine and cosine are the exception rather than the rule. - [Spacing between branches](https://www.johndcook.com/blog/2025/05/04/spacing-between-branches/) - The space between branch points for iterates of the logistic map converges to a limit known as Feigenbaum's constant, which can be computed to high precision. - [The center may not hold](https://www.johndcook.com/blog/2021/12/18/the-center-may-not-hold/) - A group homomorphism might not map the center of one group to the center of another. - [Discrete Taylor series](https://www.johndcook.com/blog/2025/01/14/discrete-taylor-series/) - Newton's interpolation formula is complicated without the right notation. With the right notation it looks very similar to Taylor's formula. - [Blow up in finite time](https://www.johndcook.com/blog/2024/03/07/blow-up-in-finite-time/) - Sometimes you can tell, without solving it, that the solution to a differential equation will blow up in finite time, and even calculate or estimate that time. - [What exactly is a day?](https://www.johndcook.com/blog/2019/10/09/what-exactly-is-a-day/) - How many times does the earth rotate on its axis during a year? One more than you think. - [Operator calculus](https://www.johndcook.com/blog/2022/10/12/operational-calculus/) - A justification for useful tricks that seem unjustified, and a worked-out example - [Elliptic curve P-384](https://www.johndcook.com/blog/2019/05/11/elliptic-curve-p-384/) - The NSA recommends P-384 for elliptic curve cryptography, both ECDH and ECDSA. This post looks at P-384 in some detail. - [Kernel and Cokernel](https://www.johndcook.com/blog/2025/04/19/kernel-and-cokernel/) - Kernel and cokernel are dual concepts, but the former is far more likely to appear in textbooks. The cokernel is often in the background without a name. - [An island of stability in a sea of chaos](https://www.johndcook.com/blog/2025/05/04/island-of-stability/) - Zooming in on an island of apparent simplicity inside the chaotic region of the logistic bifurcation diagram. - [Accelerating convergence with Aitken's method](https://www.johndcook.com/blog/2019/08/02/aitken-acceleration/) - Aitken's method for accelerating the sum of a series works well for series that are converging approximately like a geometric series. - [Translating poetry](https://www.johndcook.com/blog/2019/06/28/translating-poetry/) - You can't preserve every aspect of a text when translating. A strict word-for-word translation attempts to be faithful to the words but may be ungrammatical in the target language. An idea-for-idea translation is more readable, but still may not convey the style of the original. Translation reminds me of making maps. There have been countless - [Stellar magnitude](https://www.johndcook.com/blog/2023/08/29/stellar-magnitude/) - Stellar magnitude is -2.5 times the logarithm of brightness. Equivalently, it is the logarithm of brightness to the base 10^-2.5. - [Partition numbers and Ramanujan's approximation](https://www.johndcook.com/blog/2018/06/12/partition-numbers/) - There is no simple expression for partition numbers, but Ramanujan discovered a fairly simple asymptotic approximation. - [Sawtooth waves](https://www.johndcook.com/blog/2024/10/23/sawtooth-waves-2/) - Sawtooth waves: sound generators, driven oscillators, replicative functions, etc. - [Making an invertible function out of non-invertible parts](https://www.johndcook.com/blog/2020/04/04/feistel-networks/) - Feistel networks let you create invertible functions out of non-invertible parts. Many encryption algorithms use Feistel networks: DES, GOST, Blowfish, etc. - [Elliptic curve Diffie-Hellman key exchange](https://www.johndcook.com/blog/2023/09/15/ecdhe/) - How elliptic curve Diffie-Hellman compares to finite field Diffie-Hellman. The discrete logarithm problem. Careful choice of groups. - [Composing rotations using quaternions](https://www.johndcook.com/blog/2025/05/07/composing-rotation/) - Rotations can be represented by matrices or by quaternions. An advantage of quaternions is that the composition of rotations is very simple. - [Multiplying by quaternions on the left and right](https://www.johndcook.com/blog/2025/05/14/quaterion-mult-matrices/) - Matrix representations for multiplying by a quaternion on the left and on the right. - [Effective graph resistance](https://www.johndcook.com/blog/2025/05/21/effective-graph-resistance/) - Computing effective graph resistance is an application of the Moore-Penrose pseudoinverse. - [Interpolation instability](https://www.johndcook.com/blog/2025/05/21/runge-spikes/) - When interpolating a function at evenly spaced points, adding more interpolation points can make the accuracy worse, in practice even when not in theory. - [Looking for keys under the lamppost](https://www.johndcook.com/blog/2025/05/25/lamppost/) - What drunks and technical consultants have in common. - [How close is octonion multiplication to being associative?](https://www.johndcook.com/blog/2018/07/09/octonion-associator/) - Octonion multiplication is not associative. We look at how far it is from being associative by looking at the distribution of the norm of (xy)z - x(yz). - [Octonions sometimes associate](https://www.johndcook.com/blog/2025/05/25/octonions-sometimes-associate/) - Octionion multiplication is not associative in general. But it is associative for a useful special case. - [Representing octonions as matrices, sorta](https://www.johndcook.com/blog/2025/05/25/octonions-as-matrices/) - You can represent octonions as 2 by 2 matrices with quaternion entries. But you have to change the definition of matrix multiplication slightly to make it work. - [How often do the hands of a clock line up?](https://www.johndcook.com/blog/2025/05/28/clock-hands/) - How often do the hour and and minute hand of an analog clock point in the same direction? - [Stacking positive and negative cannonballs](https://www.johndcook.com/blog/2025/05/30/stacking-cannonballs/) - Suppose you have n cannonballs and want to stack them in tetrahedral stacks. How many stacks will you need? - [Naively computing sine](https://www.johndcook.com/blog/2025/06/09/naive-sine/) - Suppose you need to write software to compute the sine function. You were told in a calculus class that this is done using Taylor series—it's not, but that's another story—and so you start writing code to implement Taylor series. How many terms do you need? Uh, …, 20? Let's go with that. from math import - [Computing the Euler-Mascheroni Constant](https://www.johndcook.com/blog/2025/06/08/euler-mascheroni/) - Two ways of computing the Euler-Mascheroni constant, one much better than the other. Discussing software that's even better. - [Binomial number system](https://www.johndcook.com/blog/2025/06/05/binomial-number-system/) - The binomial number system represents numbers as (a, b, c) where every number is the sum C(a, 1) + C(b, 2) + C(c, 3). - [Additive and multiplicative persistence](https://www.johndcook.com/blog/2025/06/04/persistence/) - The additive persistence of a number is related to iteratively casting out nines. Multiplicative persistence is analogous but more interesting. - [Approximation of Inverse, Inverse of Approximation](https://www.johndcook.com/blog/2025/06/03/inverse-function-theorem/) - The inverse of an approximation is an approximation of the inverse. The inverse function theorem in one and several varaibles. - [False witnesses](https://www.johndcook.com/blog/2025/06/02/false-witnesses/) - On average, big composite numbers have a lot of false witnesses that suggest they're prime. - [The ellipse hidden inside Pascal's triangle](https://www.johndcook.com/blog/2025/05/31/pascals-ellipse/) - A plot of the log of a row in Pascal's triangle makes a circular arc. - [Gardener's ellipse](https://www.johndcook.com/blog/2025/06/01/gardeners-ellipse/) - Gardener's method for drawing an ellipse and how it could be useful in computer graphics - [Areal coordinates and ellipse area](https://www.johndcook.com/blog/2024/10/09/areal-coordinates-and-ellipse-area/) - Areal coordinates simplify some geometric problems, Example: area of an ellipse inscribed in a triangle. - [How Mathematica Draws a Dragonfly](https://www.johndcook.com/blog/2025/05/28/dragonfly/) - How Mathematica produces curves, such as a dragonfly or a triceratops. - [The bad version of a good test](https://www.johndcook.com/blog/2025/05/28/lucas-lehmer-test/) - How bad is the naive version of the Lucas-Lehmer test, the test used to find Mersenne primes? One little idea makes all the difference. - [Complex Conjugates versus Quaternion Conjugates](https://www.johndcook.com/blog/2021/12/18/quaternion-conjugate/) - Quaternion conjugate has a property that complex conjugate does not have: you can conjugate any quaternion by a series of multiplications and additions. - [How to multiply octonions](https://www.johndcook.com/blog/2021/12/19/multiply-octonions/) - The multiplication rules for octonions are more complicated than the rules for quaternions, but there's a way to minimize what you need to remember. - [Conjugate theorem for octonions](https://www.johndcook.com/blog/2021/12/19/conjugate-octonions/) - Yesterday I wrote about the fact that quaternions, unlike complex numbers, can form conjugates via a series of multiplications and additions. This post will show that you can do something similar with octonions. If x is an octonion x = r0 e0 + r1 e1 + … + r7 e7 where all the r's are - [Dungeons, Dragons, and Numbers](https://www.johndcook.com/blog/2025/05/24/dungeons-dragons-and-numbers/) - Riffing on a joke by Dan Piponi giving examples of numbers in the D&D alignment matrix. - [Structured frameworks for complex systems](https://www.johndcook.com/blog/2025/05/24/frameworks/) - Sometimes an LLM makes creative connections. Maybe not entirely sensical, but interesting nevertheless. - [My favorite paper: H = W](https://www.johndcook.com/blog/2025/05/24/meyers-serrin/) - The best paper tile, in my opinion, was H = W. This post unpacks what the title means. - [Wilkinson's polynomial](https://www.johndcook.com/blog/2025/05/22/wilkinsons-polynomial/) - Wilkinson's polynomial demonstrates that a tiny change to a coefficient in a polynomial might result in a huge change to the roots. - [Multiplying a matrix by its transpose](https://www.johndcook.com/blog/2025/05/20/mmt/) - Partitioning a matrix to make multiplication by its transpose more efficient. Link to a new algorithm. - [Drazin pseudoinverse](https://www.johndcook.com/blog/2025/05/21/drazin-pseudoinverse/) - The Drazin pseudoinverse is not as well known as the Moore-Penrose pseudoinverse. The Drazin pseudoinverse behaves nicely with exponents. - [Matrices of Matrices](https://www.johndcook.com/blog/2025/05/20/partitioned-matrices/) - You can partition a matrix and think of it as a matrix whose entries are matrices. You can manipulate these matrices almost as if the blocks were numbers. - [Probability of rolling a Yahtzee](https://www.johndcook.com/blog/2025/05/19/probability-of-rolling-a-yahtzee/) - Probability of rolling a Yahtzee in no more than n rolls. - [US Census area hierarchy](https://www.johndcook.com/blog/2023/11/11/us-census-hierarchy/) - Some US Census geographic area entities nest into a tidy hierarchy, but others do not. Here's a brief overview of both. - [Riff on an integration bee integral](https://www.johndcook.com/blog/2025/05/16/riff-on-an-integration-bee-integral/) - Using an integral from a competition quiz as a springboard to discuss related ideas. - [Trinomial Coefficients and Kings](https://www.johndcook.com/blog/2025/05/16/trinomial-coefficients-and-kings/) - There are two meanings of the term trinomial coefficients. One of these is related to the movement of a king on a chessboard. - [Another little chess puzzle](https://www.johndcook.com/blog/2025/05/14/another-little-chess-puzzle/) - Another chess puzzle by Martin Gardner. Place two rooks, two bishops, and two knights on a 4 by 4 board so that no piece attacks any other. - [n-queens in 3D](https://www.johndcook.com/blog/2025/05/02/n-queens-in-3d/) - Extending the n-queens problem to three dimensions. Place queens in an n by n by n cube so that no queen attacks another. - [Alternative exp and log notation](https://www.johndcook.com/blog/2025/05/13/alternative-exp-and-log-notation/) - Alternative notation for exponents and logs using up and down arrows has several advantages. Mathematical symmetries come out as visual symmetries. - [Up arrow and down arrow notation](https://www.johndcook.com/blog/2018/04/10/up-arrow-and-down-arrow-notation/) - Donald Knuth invented a notation that uses arrows to denote repeated exponentiation, and down arrows to denote repeated logarithms. - [Decimal Separator and Internationalization](https://www.johndcook.com/blog/2025/05/13/decimal-separator/) - Avoiding problems related to different conventions for representing decimals and separating thousands. - [The Cauchy distribution's counter-intuitive behavior](https://www.johndcook.com/blog/2024/09/19/cauchy-distribution/) - Averaging normal random variables reduces the scale (standard deviation). Not with Cauchy random variables, because the scale is NOT standard deviation. - [Formulating eight queens as a SAT problem](https://www.johndcook.com/blog/2025/05/11/one-hot-sat/) - How to turn the eight queens problem into a Boolean satisfiability (SAT) problem. - [Special solutions to the eight queens problem](https://www.johndcook.com/blog/2025/05/11/eight-queens-symmetry/) - There are 12 equivalence classes of solutions to the 8 queens problem. One class is highly symmetric. One is a solution to the no-three-in-line problem. - [The non-attacking bishops problem](https://www.johndcook.com/blog/2025/05/10/non-attacking-bishops/) - How many bishops can you place on a chessboard so that no bishop is attacking any other bishop? - [Too much time on their hands?](https://www.johndcook.com/blog/2009/11/07/creativity-and-criticism/) - Dan Wineman shared a profound insight on Twitter: You say "looks like somebody has too much time on their hands" but all I hear is "I'm sad because I don't know what creativity feels like." In place of "creativity" Wineman might have as easily said "persistence." I found Wineman's quote in a post by Dan - [Sorting Roman numerals](https://www.johndcook.com/blog/2025/05/09/sorting-roman-numerals/) - Alphabetical order and numerical order match surprisingly well for moderately small numbers. - [Frequency of names of English monarchs](https://www.johndcook.com/blog/2025/05/09/english-monarchs/) - Frequency of names of English monarchs, from the most common (Edward) to the least (John). - [Frequency of papal names](https://www.johndcook.com/blog/2025/05/09/frequency-of-papal-names/) - Frequency of names for popes. The most popular has been John, used 21 times, even though there was a John XXIII. - [Square root of a small number](https://www.johndcook.com/blog/2025/05/08/square-root-of-a-small-number/) - Why might it be a problem if a numerical algorithm takes the square root of a small number? Why the most obvious fix is insufficient. - [How to estimate ODE solver error](https://www.johndcook.com/blog/2020/02/19/fehlberg/) - Estimating the error in a Runge-Kutta ODE solver using Fehlberg's adaptive method, also known as RKF45. - [Cycle order in period doubling region](https://www.johndcook.com/blog/2025/05/05/cycle-order/) - In the region where the logistic map has stable periods of 2, 4, 8, 16 etc. is there a pattern to the order in which the cycle points are visited? - [Faster quaternion product rotations](https://www.johndcook.com/blog/2021/06/16/faster-quaternion-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 first fork](https://www.johndcook.com/blog/2025/05/04/the-first-fork/) - Looking at just the first fork in the bifurcation diagram for the logistic map. This is the simplest example of limit cycles. - [The simple part of the logistic map isn't that simple](https://www.johndcook.com/blog/2025/05/03/logistic-map-convergence/) - The logistic bifurcation diagram starts out simple and becomes very complex. But even the simple part is interesting when you look closer. - [Knuth's series for chi squared percentage points](https://www.johndcook.com/blog/2025/04/29/knuths-chisq/) - Knuth's asymptotic series for percentage points of the chi square probability distribution. - [Chi squared approximations](https://www.johndcook.com/blog/2025/04/28/chi-squared-approximations/) - Three ways to approximate a chi squared distribution with a normal distribution. Example using the approximations to find percentage points. - [Variance of variances. All is variance.](https://www.johndcook.com/blog/2025/04/28/variance-of-variances/) - Example of computing a point estimator and confidence interval for the variance of a data set. Drawn from run times for the Euclidean algorithm. - [Distribution of run times for Euclidean algorithm](https://www.johndcook.com/blog/2025/04/27/euclidean-algorithm-runtime/) - The run times for the Euclidean algorithm approximately follow a normal distribution. Post gives the theoretical mean and shows how well a simulation matches. - [Adjunctions](https://www.johndcook.com/blog/2025/04/27/adjunctions/) - Using the notion of adjoint in linear algebra as a motivation for the notion of adjoint in category theory. Metaphors for adjoints - [Transpose and Adjoint](https://www.johndcook.com/blog/2025/04/27/transpose-vs-adjoint/) - There's a subtle distinction between the transpose of a matrix and the adjoint of the linear operator the matrix represents. - [Overtones and Barbershop Quartets](https://www.johndcook.com/blog/2025/04/24/overtones-and-barbershop-quartets/) - Singers in a barbershop quartet will sing the 7th in a dominant 7th chord a little flat to bring the chord in line with the harmonic series. Math details. - [Morse code and the limits of human perception](https://www.johndcook.com/blog/2025/04/23/qrq/) - People are able to copy Morse code at a rate that seems to exceed the limits of human perception. How is this possible? - [Equipentatonic scale](https://www.johndcook.com/blog/2025/04/24/equipentatonic-scale/) - Dividing the octave into 5 equal parts and looking for the closest approximations in the octave divided into 12 or 24 parts. - [The multiple coupon collector problem](https://www.johndcook.com/blog/2025/04/23/multiple-coupon-problem/) - What if in the Coupon Collector Problem you wanted to collect two of each item? Or some other fixed number? - [Fredholm index](https://www.johndcook.com/blog/2025/04/20/fredholm-index/) - The Fredholm index, its robustness, and how it relates to Euler characteristic - [Fredholm Alternative](https://www.johndcook.com/blog/2025/04/20/fredholm-alternative/) - The Fredholm alternative says that for the linear equation Ax = f, for every degree of freedom for x there is a constraint on f. - [Topological Abelian Groups](https://www.johndcook.com/blog/2025/04/18/topological-abelian-groups/) - This post will venture further into abstract mathematics than most of my posts. If this isn't what you're looking for, you might try browsing here for more concrete articles. Incidentally, although I'm an applied mathematician, I also appreciate pure math. I imagine most applied mathematicians do as well. But what I do not appreciate is - [Millionth powers](https://www.johndcook.com/blog/2025/04/17/millionth-powers/) - Find a number whose millionth power begins with four distinct digits. Puzzle question by Richard Stanley. Stanley's solution explained, and a smaller solution. - [Mr. Bell and Bell numbers](https://www.johndcook.com/blog/2025/04/16/bell-numbers-2/) - How Eric Temple Bell discovered what we now call the Bell numbers. Bell's triangle, analogous to Pascal's triangle, was discovered the year Bell was born. - [1000 most common words](https://www.johndcook.com/blog/2025/04/14/1000-most-common-words/) - If you're reading text that consists of the the 1000 most common words, how much text would you expect to read before seeing every word at lest once - [Miscellaneous mathematical symbols](https://www.johndcook.com/blog/2025/04/14/miscellaneous-mathematical-symbols/) - Discussion of some of the symbols in Unicode's Miscellaneous Mathematical Symbols block. - [Erdős-Mordell triangle theorem](https://www.johndcook.com/blog/2025/04/13/erdos-mordell/) - An inequality regarding triangles that was conjectured by Paul Erdős and first proved by Louis Mordell. A weighted generalization of the same theorem. - [Logarithmic sawtooth](https://www.johndcook.com/blog/2025/04/12/logarithmic-sawtooth/) - Here's a strange integral I ran across recently [1]. It's a little surprising that the integral even exists, and more surprising that its value has a simple expression. Here's a plot of the integrand. The plot doesn't do justice to all the activity on the left end. There are an infinite number of increasingly vertical - [When Benford's law is exact](https://www.johndcook.com/blog/2025/04/12/exact-benford/) - Sometimes Benford's law seem too good to be true, such as predicting how often the leading digit of 2^n will be a 1. - [Lots of flat sides](https://www.johndcook.com/blog/2025/04/10/lots-of-flat-sides/) - Today's exponential sum has an unusual number of sides parallel to the coordinate axes. - [Top 100 radio](https://www.johndcook.com/blog/2025/04/08/top-100-radio/) - Suppose you are listening to a radio station that plays the top 100 songs in some genre. How long until you've heard all 100 songs? Assume Zip's law. - [Estimating satellite altitude from apparent motion](https://www.johndcook.com/blog/2025/04/06/satellite-altitude/) - How to estimate by observation whether a light in the sky is an airplane or a satellite, and if it's a satellite you could tell how high it is. - [Limitations on Venn diagrams](https://www.johndcook.com/blog/2024/09/28/limitations-on-venn-diagrams/) - Why do Venn diagrams almost always show the intersections of three sets and not more? Can Venn diagrams be generalized to show all intersections of more sets? That depends on the rules you give yourself for generalization. If you require that your diagram consist of circles, then three is the limit. As John Venn put - [Linear KdV dispersion](https://www.johndcook.com/blog/2025/04/04/linear-kdv-dispersion/) - The linear KdV equation provides an interesting contrast to the full (nonlinear) KdV equation. It is also useful in applications in its own right. - [Solitons and the KdV equation](https://www.johndcook.com/blog/2023/11/03/solitons-and-the-kdv-equation/) - It's rare for a nonlinear PDE to have a closed-form solution. But the Korteweg–De Vries equation does have a such a solution, a soliton. - [DIEHARDER random number generator test results for PCG and MWC](https://www.johndcook.com/blog/2017/07/10/dieharder-random-number-generator-test-results-for-pcg-and-mwc/) - Testing Maraglia's simple MWC random number generator with DIEHARDER, Robert G. Brown's extension of Marsaglia's DIEHARD test suite. - [Hypergeometric equation](https://www.johndcook.com/blog/2021/11/02/hypergeometric-ode/) - Hypergeometric functions come up very often in application. A look at the ODE they satisfy suggests why they're so common. - [Confidential OCR](https://www.johndcook.com/blog/2024/11/20/confidential-ocr/) - Convert images to text without uploading confidential data to a third party - [How well does a spline fit a function?](https://www.johndcook.com/blog/2023/02/18/spline-fit/) - Carefully quantifying the error in approximating a function by a cubic spline. - [Spreading out words in space](https://www.johndcook.com/blog/2025/03/06/spreading-out-words-in-space/) - Using vector embeddings to conceptually spread out words. - [Unicode, Tolkien, and Privacy](https://www.johndcook.com/blog/2025/03/09/tengwar/) - Unicode's private use areas are used for a wide variety of purposes, ranging from coroporate logos to fictional languages. Example of Tolkein's Tengwar. - [Closed-form minimal surface solutions](https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/) - Closed form solutions of the minimal surface equation.Non-linear differential equations don't often have closed-form solutions, but it happens. - [Fundamental solution](https://www.johndcook.com/blog/2025/03/30/fundamental-solution/) - Fundamental solutions to PDEs. An asside on rigor, and an example of a logarithm yearning to be free. - [Looking at Your Data](https://www.johndcook.com/blog/2025/03/29/looking-at-your-data/) - It is amazing what insights you might pick up from just inspecting your data. - [Superhyperbola](https://www.johndcook.com/blog/2025/03/27/superhyperbola/) - The superhyperbola is the lesser-known sister of the superellipse. - [The glass disk game](https://www.johndcook.com/blog/2025/03/26/diagram-chase-2/) - Removing all the mathematical content of the five lemma and friends, visualizing the lemmas as a game with glass disks. - [Voyager's slingshot maneuvers](https://www.johndcook.com/blog/2025/03/24/gravitational-assist/) - The discovery of gravitational assist maneuvers made the Voyager tours possible. Graph of how Voyager 2 gained, or lost, speed passing each planet. - [Advantages of Reed-Solomon codes over Golay codes](https://www.johndcook.com/blog/2025/03/24/reed-solomon-golay/) - The Voyager probes changed error correction schemes mid-flight because the new Reed Solomon scheme was so much better than the previous Golay scheme. - [Very accurate pi approximation](https://www.johndcook.com/blog/2025/03/23/very-accurate-pi-approximation/) - A very accurate approximation for pi, exact within the limits of floating point, and its connection to a better known approximation. - [Hand calculating exp(x)](https://www.johndcook.com/blog/2025/03/23/hand-calculating-expx/) - How would you calculate exp(x) without a computer? As an example, would calculating exp(π√163) have been daunting for Ramanujan? - [Interior of a conic](https://www.johndcook.com/blog/2025/03/20/interior-of-a-conic/) - How can the interior of a conic section be defined in a uniform way, so that it matches our expectations in cases where we have a sense of what it should be - [HCPCS ("hick pics") codes](https://www.johndcook.com/blog/2022/09/23/hcpcs-codes/) - Searching for HCPCS ("hick picks") medical procedure codes in text and why you might want to do so - [Grokking the James Bond chord](https://www.johndcook.com/blog/2025/03/16/grokking-james-bond/) - Using Grok 3 to generate sheet music for the "James Bond chord," the chord at the end of the James Bond theme. - [Gluons, quarks, letters, and envelopes](https://www.johndcook.com/blog/2025/03/16/gluons-and-quarks/) - How a question about permutations relates to diagrams of gluon and quark interactions, and to letters stuffed randomly in envelopes. - [Rates of convergence](https://www.johndcook.com/blog/2025/03/16/rates-of-convergence/) - Looking at two probabilities that both converge to 1/e, but at different rates. - [Permutations with no consecutive elements](https://www.johndcook.com/blog/2025/03/15/permutations-question/) - What proportion of permutations of the first n digits have no consecutive elements? How to compute. - [Example using a generating function to find asymptotic behavior](https://www.johndcook.com/blog/2025/03/15/egf-asymptotic/) - Proof that for large n, the probability that a random permutation leaves no two consecutive terms is 1/e. - [Computing the nth digit of π directly](https://www.johndcook.com/blog/2025/03/14/bbp/) - The following equation, known as the BBP formula [1], will let you compute the nth digit of π directly without having to compute the previous digits. I've seen this claim many times, but I've never seen it explained in much detail how this formula lets you extract digits of π. First of all, this formula - [Colossus versus El Capitan: A Tale of Two Supercomputers](https://www.johndcook.com/blog/2025/03/10/colossus-versus-el-capitan/) - Colossus and El Capitan are two of the world's most powerful supercomputers. In this post we look at which one is most capable and why. - [Unicode surrogates](https://www.johndcook.com/blog/2025/03/09/unicode-surrogates/) - Unicode surrogate characters are not characters per se but escape sequence of a sort, used to represent code points outside the basic multilingual plane. - [The difference between tokens and words](https://www.johndcook.com/blog/2025/03/07/tokens-and-words/) - How tokens in LLMs correspond to words. Examples using GPT 3.5 and GPT - [A simpler GELU activation function approximation](https://www.johndcook.com/blog/2025/03/06/gelu/) - The GELU (Gaussian Error Linear Units) activation function was proposed in [1]. This function is x Φ(x) where Φ is the CDF of a standard normal random variable. As you might guess, the motivation for the function involves probability. See [1] for details. The GELU function is not too far from the more familiar ReLU, - [Practical consequences of tokenization details](https://www.johndcook.com/blog/2025/03/09/practical-tokenization/) - Understanding the details of tokenization could help you write better LLM prompts. - [ChatGPT tokens and Unicode](https://www.johndcook.com/blog/2025/03/08/chatgpt-tokens-and-unicode/) - How the tokenizer used in ChatGPT tokenizes Unicode characters. - [Higher order Taylor series in several variables](https://www.johndcook.com/blog/2017/12/11/higher-order-taylor/) - Higher order Taylor series for functions of several variables naturally involve tensors, but there's a way to avoid tensors and use just vectors and matrices. - [What is partial pivoting?](https://www.johndcook.com/blog/2025/03/01/what-is-partial-pivoting/) - Gaussian elimination, as it is commonly presented to students, may fail or run into numerical precision problems. Partial pivoting usually fixes these problems. - [On Making Databases Run Faster](https://www.johndcook.com/blog/2025/03/05/on-making-databases-run-faster/) - Database software should give fast access speeds to data values by default. But that is not always the case. Here we discuss an example. - [Reproducing a hand-drawn plot](https://www.johndcook.com/blog/2025/03/03/reproducing-a-hand-drawn-plot/) - Reproducing a manually drawn plot from 1945 using Mathematica. - [Duplicating a hand-drawn contour plot](https://www.johndcook.com/blog/2025/03/03/mathematica-contour-plot/) - Reproducing a hand-drawn plot in Mathematica. Specifying the contour values rather than letting Mathematica automatically choose them. - [Using classical statistics to avoid regulatory burden](https://www.johndcook.com/blog/2023/11/01/using-classical-statistics-to-avoid-regulatory-burden/) - Using a classical statistical model rather than an AI model could spare your company from hastily written regulations. - [Executive order on differential privacy](https://www.johndcook.com/blog/2023/11/01/executive-order-on-differential-privacy/) - This week President Biden signed a long, technically detailed executive order (Executive Order 14110) that among other things requires the Secretary of Commerce to look into differential privacy. Within 365 days of the date of this order … the Secretary of Commerce … shall create guidelines for agencies to evaluate the efficacy of differential-privacy-guarantee protections, - [Distribution of zeros of the Riemann zeta](https://www.johndcook.com/blog/2018/08/23/riemann-zeta-zeros/) - The zeros of the Riemann zeta function have the same spacing distribution as the eigenvalues of Gaussian random matrices. - [Applied topology and Dante: an interview with Robert Ghrist](https://www.johndcook.com/blog/2010/09/13/applied-topology-and-dante-an-interview-with-robert-ghrist/) - An interview with Robert Ghrist, an applied topologist. In addition to his mathematical work, we discuss his interest in literature, especially Dante. - [Visually symmetric words](https://www.johndcook.com/blog/2022/12/27/visually-symmetric-words/) - The word "kayak" is a palindrome, but it isn't visually symmetric. The word "bud" is visually symmetric, but not a palindrome. - [Looking at the bits of a Unicode (UTF-8) text file](https://www.johndcook.com/blog/2020/09/06/unicode-file-bits/) - In this post we crack open a Unicode text file and see what's going on at the bit level. - [Naming Awk](https://www.johndcook.com/blog/2023/09/21/naming-awk/) - A little history behind the name of the Awk programming language - [Code Profiling Without a Profiler](https://www.johndcook.com/blog/2025/02/27/code-profiling-without-a-profiler/) - How can you tell what parts of your code are taking the most runtime, if you don't have or can't use a profiler? In this article we show how. - [Do perimeter and area determine a triangle?](https://www.johndcook.com/blog/2025/02/26/perimeter-area/) - If two triangles have the same perimeter and area, are the triangles congruent? - [Complex golden convergence](https://www.johndcook.com/blog/2025/02/23/complex-golden-convergence/) - Extending an iteration for the golden ratio to the complex plane. Visualizing the convergence. - [Settlers versus Hipsters](https://www.johndcook.com/blog/2025/02/24/settlers-versus-hipsters/) - When my children were little, I read the Little House on the Prairie books aloud to them and I naturally saw the books through the eyes of a child. Last night I started reading the books by myself for the first time and saw them very differently. Laura Ingalls Wilder wrote the Little House books - [Accuracy, precision, and recall](https://www.johndcook.com/blog/2018/09/06/accuracy-precision-and-recall/) - Accuracy,. precision, and recall. As well as a host of similar definitions that nobody can keep up with. - [Golden convergence](https://www.johndcook.com/blog/2025/02/22/golden-convergence/) - Proving and visualizing the convergence of a nested radical equation for the golden ratio - [The Buenos Aires constant](https://www.johndcook.com/blog/2025/02/18/the-buenos-aires-constant/) - Generating primes using the Buenos Aires constant. - [Mnemonic images with Grok 3](https://www.johndcook.com/blog/2025/02/20/mnemonic-images-grok-3/) - Generative AI for images has come a long way. Comparing attempts to create images in DALL-E 2 and Grok 3. - [Standing with Intellectual Giants](https://www.johndcook.com/blog/2025/02/20/standing-with-intellectual-giants/) - Is it possible to develop innovative ideas when you're not part of the institutions where the expertise resides? In this article we examine perspectives. - [Rich Sutton's bitter lesson of AI](https://www.johndcook.com/blog/2025/02/20/bitter-lesson/) - Brute force computation trumps human-crafted specialization in AI, but you're better off applying logic or classical statistics if you can. - [Multiplication tables and Latin squares](https://www.johndcook.com/blog/2025/02/19/cayley-table-latin-square/) - The multiplication table of a group, i.e. its Cayley table, is always a Latin square. Example with quaternion units. - [Quaternion square roots](https://www.johndcook.com/blog/2021/01/06/quaternion-square-roots/) - A quaternion has either 1, 2, or infinitely many square roots. This post explains each case and how to find the roots. - [1 + 2 + 3 + … = −1/12](https://www.johndcook.com/blog/2025/02/13/1-2-3/) - What does 1 + 2 + 3 + … = − 1/12 even mean? What are some more equations like this? - [Multiple angle asymmetry](https://www.johndcook.com/blog/2025/02/13/multiple-angle-asymmetry/) - cos nθ can be written as a polynomial in cos θ, but sin nθ cannot be written as a polynomial in sin θ unless n is odd. Proof and application - [Russian Morse Code](https://www.johndcook.com/blog/2025/02/12/russian-morse-code/) - How does Russian Morse code compare to International Morse Code? How hard would it be to switch from one to the other? - [Posthumous Chebyshev Polynomials](https://www.johndcook.com/blog/2025/02/12/chebyshev-third-fourth/) - Chebyshev polynomials of the third and fourth kind, and how they relate to the more familiar Chebychev polynomials of the first and second kind. - [Sparse binary Pythagorean triples](https://www.johndcook.com/blog/2025/02/11/binary-triples/) - A family of Pythagorean triples with simple representations as binary numbers. - [DeepSeek-R1: Do we need less compute now?](https://www.johndcook.com/blog/2025/02/03/deepseek-r1-do-we-need-less-compute-now/) - Recent claims are that DeepSeek-R1 decreases the need for multi-billion dollar compute systems for AI. Is this correct? Here we look at history to find out. - [How to memorize the ASCII table](https://www.johndcook.com/blog/2022/05/28/how-to-memorize-the-ascii-table/) - Memorizing a table of ASCII values is not as hard as it sounds, especially if you already know a few other things. - [Four uncommon but handy math notations](https://www.johndcook.com/blog/2008/09/22/four-uncommon-but-handy-math-notations/) - Here are some of my favorite notations that are not commonly used. The first is Richard Stanley's notation for counting the number of ways to select k objects from a set of n objects with replacement. This is similar to the problem solved by binomial coefficients, but not the same since binomial coefficients count the - [You do not want to be an edge case](https://www.johndcook.com/blog/2015/11/13/you-do-not-want-to-be-an-edge-case/) - As software works better for most people, it can make life harder on the people who don't meet the developer's expectations. - [Differential entropy and privacy](https://www.johndcook.com/blog/2023/11/01/differential-entropy-and-privacy/) - Quantifying the privacy of a random variable as the exponential of differential entropy. Examples and basic properties. - [ChaCha RNG with fewer rounds](https://www.johndcook.com/blog/2020/02/22/chacha-rng-with-fewer-rounds/) - ChaCha is typically used with 20 rounds in encryption, but 8 to 12 rounds may be enough, and even fewer round suffice for statistical application. - [Analogy between prime numbers and simple groups](https://www.johndcook.com/blog/2023/09/26/prime-numbers-simple-groups/) - Groups break down into simple groups analogous to how numbers break down into primes. Examining this analogy a little closer. - [Writing down an unwritten language](https://www.johndcook.com/blog/2014/02/24/creating-a-writing-system/) - In this post I interview Greg Greenlaw, a friend of mine who served as a missionary to the Nakui tribe in Papua New Guinea and developed their writing system. (Nakui is pronounced like "knock we.") JC: When you went to PNG to learn Nakui was there any writing system? GG: No, they had no way - [Hidden messages in music](https://www.johndcook.com/blog/2023/01/06/hidden-messages-in-music/) - Videos from Dr. Geoff Lindsey about words and Morse code hidden in music. - [Starlink configurations](https://www.johndcook.com/blog/2024/12/23/starlink-configurations/) - If you see a line of lights in the sky, it's likely a set of Starlink satellites launched at the same time. - [Some mathematical art](https://www.johndcook.com/blog/2020/11/09/some-mathematical-art/) - Unusual plots created by an unusual coordinate system - [Blaschke factors](https://www.johndcook.com/blog/2022/04/20/blaschke-factors/) - Blaschke factors are a special case of bilinear transformations and are the building blocks of Blaschke products. - [Double rounding](https://www.johndcook.com/blog/2025/01/23/double-rounding/) - If you round a number to one precision and then again to another precision, you may get a different result than if you had rounded directly. - [Matrix representations of number systems](https://www.johndcook.com/blog/2025/01/28/matrix-representation/) - Representing complex numbers, dual numbers, and double numbers as real 2 by 2 matrices. - [A magical land where rounding equals truncation](https://www.johndcook.com/blog/2025/01/23/balanced-ternary-rounding/) - The balanced ternary number system has many interesting properties, including the fact that truncation is the same as rounding. - [Fibonacci number system](https://www.johndcook.com/blog/2015/05/17/fibonacci-number-system/) - Every positive integer can be written as the sum of distinct Fibonacci numbers. This representation is unique if you disallow consecutive Fibonacci numbers. - [Euler's formula for dual numbers and double numbers](https://www.johndcook.com/blog/2025/01/28/euler-dual-double/) - Analogs of Euler's formula exp(ix) = cos(x) + i sin(x) in other number systems, namely dual numbers and double numbers. - [Duplicating Hankel plot from A&S](https://www.johndcook.com/blog/2025/01/22/duplicating-hankel-plot-from-as/) - Using Mathematica to reproduce an interesting plot from Abramowitz and Stegun - [An unexpected triangle](https://www.johndcook.com/blog/2025/01/18/sonine/) - Sonine's formula surprisingly evaluates an integral in terms of the area of a triangle formed by the integral parameters - [Area of a quadrilateral from the lengths of its sides](https://www.johndcook.com/blog/2025/01/19/quadrilateral-area/) - How to find the area of a quadrilateral from the lengths of its sides. Generalizations of Heron's formula - [Entering Russian characters in Vim with digraphs](https://www.johndcook.com/blog/2025/01/18/vim-russian-letters/) - How to enter Russian letters in Vim using digraphs. What is the logic to how digraphs correspond to Russian letters - [Chebyshev and Russian transliteration](https://www.johndcook.com/blog/2025/01/18/russian-transliteration/) - It's not simple to transliterate Russian names to English. Sometimes there is a unique mapping, or at least a standard mapping, of a particular name, but often there is not. An example that comes up frequently in mathematics is Pafnuty Lvovich Chebyshev (1821–1894). This Russian mathematician's name Пафну́тий Льво́вич Чебышёв has been transliterated at Tchebichef, - [Law of cotangents](https://www.johndcook.com/blog/2023/01/05/law-of-cotangents/) - Law of cotangents: the most obscure of trigonometry laws - [Dimensional analysis for gamma function values](https://www.johndcook.com/blog/2025/01/16/gamma-dimensional-analysis/) - Thinking of factorials and gamma function values as having dimensions can make equations easier to remember, find errors, and suggest results. - [Can AI Models Reason: Is Data All You Need?](https://www.johndcook.com/blog/2025/01/16/can-ai-models-reason-is-data-all-you-need-2/) - Lack of enough training data is widely seen as a limiter for developing more powerful AI models. Is this problem solvable? Here we examine the issues. - [Falling power analog of binomial theorem](https://www.johndcook.com/blog/2025/01/15/chu-vandermonde/) - The Chu-Vandermonde theorem, when written in the right notation, looks very much like the binomial theorem. - [Why eliminate trusted third parties?](https://www.johndcook.com/blog/2025/01/15/peer-to-peer/) - Encryption technology can eliminate the need to trust third parties, but why is that a good thing? What are the motivations and tradeoffs - [Consulting Podcast](https://www.johndcook.com/blog/2025/01/11/consulting-podcast/) - A friend just sent me an audio file of a podcast about my consulting that he created by asking an AI to crawl my web site. The podcast is a remarkably natural-sounding conversation between two synthetic hosts. The only clues that the audio is automatically generated are a couple of mispronounced acronyms. Download - [Can AI models reason like a human?](https://www.johndcook.com/blog/2025/01/07/can-ai-models-reason-like-a-human/) - Many claims and counterclaims are made about the abilities of AI models to reason. Can they think like a human? In this article we explore the issues. - [Podcast feed](https://www.johndcook.com/blog/2025/01/11/podcast-feed/) - Announcing a new VERY OCCASIONAL podcast. - [RSA security in light of news](https://www.johndcook.com/blog/2025/01/09/rsa-news/) - Someone factored a 512-bit RSA key for $8 of computing resources. What does that imply about RSA keys of recommended length? - [Converse of RSA](https://www.johndcook.com/blog/2025/01/06/rsa-factoring/) - If you can factor large numbers, you can break RSA encryption. But if you can break RSA encryption, can you factor large numbers? - [Quick change directory](https://www.johndcook.com/blog/2025/01/07/qcd/) - A shell script to quickly change to commonly used directories. - [How to avoid shell scripting](https://www.johndcook.com/blog/2013/08/19/how-to-avoid-shell-scripting/) - Suppose you know a scripting language (Perl, Python, Ruby, etc) and you'd rather not learn shell scripting (bash, PowerShell, batch, etc.). Or maybe you know shell scripting on one platform and don't want to take the time right now to learn shell scripting on another platform. For example, maybe you know bash on Linux but - [The Clausen function](https://www.johndcook.com/blog/2024/07/01/the-clausen-function/) - The Clausen function looks, and sounds, like something between a sine wave and a sawtooth wave. - [Unicode Steganography](https://www.johndcook.com/blog/2025/01/02/unicode-stegonography/) - Unicode characters with different values that look the same can be used to hide messages inside other messages. Can also be used maliciously to trick users. - [Up to isomorphism](https://www.johndcook.com/blog/2025/01/01/up-to-isomorphism/) - When "up to isomorphism" needs to be said and doesn't need to be said. Isomorphic ways of listing the groups of order 2025. - [Abelian groups of order 2025](https://www.johndcook.com/blog/2025/01/01/abelian-groups-of-order-2025/) - How many distinct Abelian groups are there of order 2025? More generally, how do you find all the Abelian groups of any order? - [Carnival of Mathematics 235](https://www.johndcook.com/blog/2025/01/02/carnival-of-mathematics-235/) - Carnival of Mathematics 235. Posts from math bloggers around the internet. - [Computing days of the week in your head](https://www.johndcook.com/blog/2010/12/08/computing-days-of-the-week-in-your-head/) - Years ago I taught a "math for poets" class. (I don't remember the actual name of the course. Everyone called it "math for poets" because it was the one math class humanities majors had to take.) I taught the students how to mentally figure out days of the week and they loved it. It was - [Career advice regarding tools](https://www.johndcook.com/blog/2011/11/21/career-advice-regarding-tools/) - A few weeks ago, J. D. Long gave some interesting advice in a Google+ discussion. He starts out Lunch today with an analyst 13 years my junior made me think about things I wish I had known about the technical analytical profession when I was 25. Here's some things that popped into my head: The - [Asteroids can have moons](https://www.johndcook.com/blog/2013/05/09/asteroids-can-have-moons/) - This afternoon my postman delivered a review copy of The Space Book by Jim Bell. This is the latest book in a series that includes Cliff Pickover's math, physics, and medical books. Like the other books in the series, The Space Book alternates one-page articles and full-page color images. Here's something I learned while skimming - [Technical memento mori](https://www.johndcook.com/blog/2016/04/06/technical-memento-mori/) - A book on an obsolete technology serves a similar function as a skull on a medieval scholar's desk. - [The big deal about neural networks](https://www.johndcook.com/blog/2016/10/14/the-big-deal-about-neural-networks/) - Excerpt from Efron and Hastie's book Computer Age Statistical Inference that gives a good description of neural networks and their importance. - [Rise and Fall of the Third Normal Form](https://www.johndcook.com/blog/2012/11/21/rise-and-fall-of-the-third-normal-form/) - The ideas for relational databases were worked out in the 1970s and the first commercial implementations appeared around 1980. By the 1990s relational databases were the dominant way to store data. There were some non-relational databases in use, but these were not popular. Hierarchical databases seemed quaint, clinging to pre-relational approaches that had been deemed - [Upcoming Y2K-like problems](https://www.johndcook.com/blog/2009/06/13/upcoming-y2k-like-problems/) - The world's computer systems kept working on January 1, 2000 thanks to billions of dollars spent on fixing old software. Two wrong conclusions to draw from Y2K are The programmers responsible for Y2K bugs were losers. That's all behind us now. The programmers who wrote the Y2K bugs were highly successful: their software lasted longer - [A little coffee on the prairie](https://www.johndcook.com/blog/2009/11/04/little-coffee-on-the-prairie/) - I was reading Little House on the Prairie with my youngest daughter the other day. Here's a passage that surprised me. Then Pa brought water from the creek, while Mary and Laura helped Ma get supper. Ma measured coffee beans into the coffee mill and Mary ground them. I'd read this book with my other - [A few questions with Frederick Brooks](https://www.johndcook.com/blog/2010/05/26/fred-brooks-interview/) - The shelf life of software development books is typically two or three years, maybe five or ten years for a "classic." Frederick Brooks, however, wrote a book on software development in 1975 that remains a best-seller: The Mythical Man-Month. His book has remained popular because he wrote about human nature as applied to software development, - [The 1970s](https://www.johndcook.com/blog/2012/05/21/the-1970s/) - Here's a perspective on the 1970s I found interesting: The decade was so embarrassing that climbing out of the '70s was a proud achievement. The 1970s were America's low tide. Not since the Depression had the country been so wracked with woe. Never — not even during the Depression — had American pride and self-confidence - [Cancer moon shots](https://www.johndcook.com/blog/2012/09/21/cancer-moon-shots/) - M. D. Anderson Cancer Center announced a $3 billion research program today aimed at six specific forms of cancer. Acute myeloid leukemia and myelodysplastic syndrome (AML and MDS) Chronic lymphocytic leukemia (CLL) Lung cancer Melanoma Prostate cancer Triple negative breast and ovarian cancer These special areas of research are being called "moon shots" by analogy - [Improving on the Unix shell](https://www.johndcook.com/blog/2017/03/03/improve-on-unix-shell/) - Despite its conspicuous quirks, the Unix shell did something right, maybe something we don't fully understand, that makes it hard to improve on. - [Sorting](https://www.johndcook.com/blog/2011/07/04/sorting/) - From Donald Knuth's book Sorting and Searching: Computer manufacturers of the 1960s estimated that more than 25 percent of the running time of their computers was spent on sorting, when all their customers were taken into account. In fact, there were many installations in which the task of sorting was responsible for more than half - [Cancer center ash tray](https://www.johndcook.com/blog/2013/01/22/cancer-center-ash-tray/) - In the 1950s, the gift shop at MD Anderson Cancer Center (then MD Anderson Hospital and Tumor Institute) sold ashtrays bearing the institutional seal. This from a time when doctors advertised cigarettes. Related post: The campaign to get women to smoke - [The great reformulation of algebraic geometry](https://www.johndcook.com/blog/2014/09/25/the-great-reformulation/) - An interview with John Tate in which he talks about group cohomology and the great reformulation of algebraic geometry - [Hypothesis testing and number theory](https://www.johndcook.com/blog/2016/06/20/hypothesis-testing-and-number-theory/) - Example of hypothesis test for a proportion, looking at some patterns in primes and factorials - [Early evidence-based medicine](https://www.johndcook.com/blog/2008/12/28/early-evidence-based-medicine/) - In the 1840s, Ignaz Semmelweis, an assistant professor in the maternity ward of Vienna General Hospital, demonstrated that mortality rates dropped from 12 percent to 2 percent when doctors washed their hands between seeing patients. His colleagues resisted his findings for a couple reasons. First, they didn't want to wash their hands so often. Second, Semmelweis - [Subnatural and supernatural](https://www.johndcook.com/blog/2009/11/17/subnatural-and-supernatural/) - I recently ran across a discussion of quantum mechanics from C. S. Lewis. The older scientists believed that the smallest particles of matter moved according to strict laws: in other words, that the movements of each particle were "interlocked" with the total system of Nature. Some modern scientists seem to think — if I understand - [Metabolism and power laws](https://www.johndcook.com/blog/2009/04/16/metabolism-and-power-laws/) - Bigger animals have more cells than smaller animals. More cells means more cellular metabolism and so more heat produced. How does the amount of heat an animal produces vary with its size? We clearly expect it to go up with size, but does it increase in proportion to volume? Surface area? Something in between? A - [Physical constants in Python](https://www.johndcook.com/blog/2018/10/04/physical-constants-in-python/) - How to compute the fine structure constant in Python, and its relation to Eddington's constant. - [Fibonacci numbers and hyperbolic sine](https://www.johndcook.com/blog/2021/02/03/askey-fibonacci/) - Using a formula for Fibonacci numbers in terms of hyperbolic sine as a jumping off point to discuss how equations are applied, branch cuts, & Python computing. - [The Stone Age didn't end because we ran out of stones](https://www.johndcook.com/blog/2010/08/04/the-stone-age-didnt-end-because-we-ran-out-of-stones/) - According to Richard Sears, the world hit peak oil in 1985 in the sense that oil accounted for 50% of world energy in 1985 and the percentage has been declining since then. By that same measure, we hit peak coal in the 1920s and peak wood in the 1820s. Sears summarizes For 200 years we - [The base with the largest decibel](https://www.johndcook.com/blog/2021/05/18/the-base-with-the-largest-decibel/) - The base of natural logs, e, is the base with the largest decibel unit. - [Why computer scientists count from zero](https://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/) - The vast majority of humanity finds counting from 0 unnatural and so there is a conflict between how software producers and consumers count. - [Strategy for dealing with information overload](https://www.johndcook.com/blog/2009/02/24/the-solution-to-information-overload/) - Clay Shirky gave a thought-provoking presentation "It's Not Information Overload. It's Filter Failure." He argues that information overload is not new. Ever since Gutenberg most people have had access to more information than they could handle. But until recently there were effective mechanisms for filtering this information: social norms, slow communication, etc. The solution is - [How to compute the soft maximum](https://www.johndcook.com/blog/2010/01/20/how-to-compute-the-soft-maximum/) - The most obvious way to compute the soft maximum can easily fail due to overflow or underflow. The soft maximum of x and y is defined by g(x, y) = log( exp(x) + exp(y) ). The most obvious way to turn the definition above into C code would be double SoftMaximum(double x, double y) { - [Poetic description of privacy-preserving analysis](https://www.johndcook.com/blog/2018/11/28/poetic-privacy/) - Erlingsson et al give a poetic description of privacy-preserving analysis in their RAPPOR paper [1]. They say that the goal is to … allow the forest of client data to be studied, without permitting the possibility of looking at individual trees. Related posts What is differential privacy? Data privacy consulting [1] Úlfar Erlingsson, Vasyl Pihur, and - [Big data and privacy](https://www.johndcook.com/blog/2018/11/12/big-data-and-privacy/) - How does big data impact privacy? Which is a bigger risk to your privacy, being part of a little database or a big database? - [Connection between hypergeometric distribution and series](https://www.johndcook.com/blog/2016/02/08/connection-between-hypergeometric-distribution-and-series/) - Connections between the hypergeometric distribution and hypergeometric functions via the probability generating function and CDF. - [Distribution of quadratic residues](https://www.johndcook.com/blog/2019/07/12/distribution-of-quadratic-residues/) - Let p be an odd prime number. If the equation x² = n mod p has a solution then n is a square mod p, or in classical terminology, n is a quadratic residue mod p. Half of the numbers between 0 and p are quadratic residues and half are not. The residues are distributed - [Power method and centrality](https://www.johndcook.com/blog/2024/06/12/power-method-and-centrality/) - In principle, you could calculate eigenvector centrality by counting the number of paths of length n through a network for large n. But not in practice. - [Living within chosen limits](https://www.johndcook.com/blog/2009/04/02/living-within-chosen-limits/) - The latest EconTalk podcast is an interview with Brink Lindsey, author of The Age of Abundance. Lindsey said that in the 1980s and 90s we learned how to live with the freedoms gained in the 1960s and 70s. Many negative social indicators soared in the 60s and 70s: crime, divorce, drug use, abortion, etc. But - [Small probabilities add, big ones don't](https://www.johndcook.com/blog/2024/05/10/small-probabilities-add/) - When can you get away with naively adding probabilities and when can you not? Why is this? What does it depend on? - [Subtle variation on gaining weight to become taller](https://www.johndcook.com/blog/2010/09/05/subtle-variation-on-gaining-weight-to-become-taller/) - Back in March I wrote a blog post asking whether gaining weight makes you taller. Weight and height are clearly associated, and from that data alone one might speculate that gaining weight could make you taller. Of course causation is in the other direction: becoming taller generally makes you gain weight. In the 1980s, cardiologists - [Software quality: better in practice than in theory](https://www.johndcook.com/blog/2018/09/25/software-quality-economics/) - At one time formal methods were thought to be the only hope for software development. That did not turn out to be the case. - [Up-down permutations](https://www.johndcook.com/blog/2023/07/31/alternating-permutations/) - What are up-down permutations, a.k.a. alternating permutations? Generating function for how many up-down permutations there are. - [Computed IDs and privacy implications](https://www.johndcook.com/blog/2019/10/31/computed-ids-and-privacy/) - States used to compute your driver's license number from your personal information. Nobody thought at the time this could be a problem. - [Random inequalities I: introduction](https://www.johndcook.com/blog/2008/07/26/random-inequalities-i/) - Introduction to probability inequalities used in, for example, adaptively randomized clinical trials. - [Index of coincidence](https://www.johndcook.com/blog/2021/08/14/index-of-coincidence/) - Index of coincidence and Renyi entropy. - [Fixed points of bilinear transformations](https://www.johndcook.com/blog/2022/04/21/mobius-fixed-points/) - Möbius transformations, a.k.a. bilinear transformations, typically have two fixed points: one attracting and one repelling. - [Fractional linear and linear](https://www.johndcook.com/blog/2023/09/22/fractional-linear-and-linear/) - Fractional linear transformations really are linear transformations, but on a different space. - [Definition of faith](https://www.johndcook.com/blog/2010/04/30/definition-of-faith/) - C. S. Lewis wrote that Faith is holding on to things your reason has once accepted, in spite of your changing moods. When someone says "I can't believe it's Tuesday" he really means that he does believe it's Tuesday, but it takes effort. His emotions are telling him that it is some other day, but he chooses - [Termites and programmers](https://www.johndcook.com/blog/2009/09/01/termites-and-programmers/) - There are more termites in the world than there are elephants. Not only that, the total mass of the world's elephants is roughly 1/1000 the total mass of the world's termites. The big, visible animals, the ones that first come to mind, are a small fraction of the total. Something similar is true of software - [Mystery curve](https://www.johndcook.com/blog/2015/06/03/mystery-curve/) - Pretty curve made by adding and plotting three complex exponentials - [A truly horrible random number generator](https://www.johndcook.com/blog/2019/04/14/randu/) - I needed a bad RNG for an illustration, and RANDU turned out to be even worse than I expected. - [Duodecimal vs Hexadecimal](https://www.johndcook.com/blog/2021/04/18/duodecimal/) - The word "duodecimal" faded into obscurity around the time "hexadecimal" became widely used. - [Evolution of random number generators](https://www.johndcook.com/blog/2021/04/29/reinventing-rng/) - Prime powers have a kinda chaotic pattern in their bits. We bootstrap this idea into a good random number generator, recapitulating history. - [Set theory at the command line](https://www.johndcook.com/blog/2019/11/24/comm-set-theory/) - The comm utility lets you find which lines are unique to one file or another, and which lines are common to both. - [The Chicken McNugget Monoid](https://www.johndcook.com/blog/2022/10/10/mcnugget-monoid/) - The possible numbers of Chicken McNuggets you could order at McDonalds forms a monoid, and includes all integers greater than 43. - [Mercury and the bandwagon effect](https://www.johndcook.com/blog/2017/04/09/mercury-and-the-bandwagon-effect/) - For eighty years astronomers thought Mercury was like Earth. Then for another eighty years they thought it was like the moon. It's not like either. - [Modal axioms and rules for interplanetary travel](https://www.johndcook.com/blog/2022/01/22/modal-axiom-cube/) - Axioms for modal logic correspond to properties of directed graphs between worlds. - [Jacobi functions with complex parameter](https://www.johndcook.com/blog/2022/12/13/jacobi-complex-parameter/) - In applications of Jacobi functions the parameter m is often real, but it can be any complex number. What changes when m is complex? - [Redundant Residue Number Systems](https://www.johndcook.com/blog/2020/12/05/rrns/) - A Redundant Residue Number System (RRNS) gives a way to carry out arithmetic in parallel with error detection and correction. - [Filtering on how words are being used](https://www.johndcook.com/blog/2023/07/18/dependency-labels/) - Finding when words are being used as subjects, direct objects, indirect objects etc with spaCy dependency labels. - [Pressing the cosine key over and over](https://www.johndcook.com/blog/2024/12/17/cos-key-fixedpoint/) - If you press the cosine key on a calculator over and over, you always end at the same place. Why is that? Proving convergence and rate of convergence. - [Interval arithmetic and fixed points](https://www.johndcook.com/blog/2024/12/19/interval-arithmetic/) - Interval arithmetic illustrated by analyzing iterations of cosine - [Details of generating primes for cryptography](https://www.johndcook.com/blog/2024/12/31/generating-primes-for-rsa/) - RSA public key cryptography requires finding a couple large primes. You essentially do this by testing random numbers until you find primes, but not quite. - [Universal time](https://www.johndcook.com/blog/2010/01/28/universal-time/) - Universal time (UTC) is the same as Greenwich Mean Time (GMT), give or take a second. It's essentially the time in Greenwich, England except it ignores Daylight Savings Time. The abbreviation UTC is an odd compromise. The French wanted to use the abbreviation TUC (temps universel coordonné) and the English wanted to use CUT (coordinated - [A bevy of ones](https://www.johndcook.com/blog/2020/08/13/a-bevy-of-ones/) - For any number k relatively prime to 10, there is some multiple of k whose decimal representation has only 1's. This generalizes to all bases. - [Most popular posts of 2024](https://www.johndcook.com/blog/2024/12/24/most-popular-2024/) - Most popular posts on this site in 2024, according to Hacker News. - [Series for the reciprocal of the gamma function](https://www.johndcook.com/blog/2024/12/24/reciprocal-gamma-series/) - The relation between the asymptotic series for the gamma function and its reciprocal is simpler than we'd expect. - [Hohmann transfer orbit](https://www.johndcook.com/blog/2020/06/15/hohmann-transfer-orbit/) - A spacecraft orbiting can't move to a higher orbit like a a car changing lanes going around a racetrack because velocity and altitude are tightly coupled. - [Putting a face on a faceless account](https://www.johndcook.com/blog/2024/12/20/grok_images/) - Playing around with Grok, getting it to create images for X accounts with no face associated. - [Simple error function approximation](https://www.johndcook.com/blog/2024/12/18/erf-approx/) - The function sin(sin(x)) makes a remarkably good approximation to the error function, up to a constant. - [Can AI models reason: Just a stochastic parrot?](https://www.johndcook.com/blog/2024/12/19/is-ai-just-a-stochastic-parrot/) - Some argue AI models don't truly reason. AI models can indeed just repeat their training data mindlessly. However, they are able to do more than just this. - [Normal probability approximation](https://www.johndcook.com/blog/2024/12/19/normal-probability-approximation/) - Illustrating that the CDF of a normal random variable can be well approximated by sin(sin(x)). - [The IQ Test That AI Can't Pass](https://www.johndcook.com/blog/2024/01/16/the-iq-test-ai-cant-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 search for the perfect prompt](https://www.johndcook.com/blog/2024/06/10/the-search-for-the-perfect-prompt/) - Writing a good prompt for an AI chatbot can be difficult. Automatic prompt refinement tools are a proposed solution. Here we evaluate some of these tools. - [LLMs and regular expressions](https://www.johndcook.com/blog/2024/12/15/llm-and-regex/) - LLMs and regular expressions are complementary. What is difficult with one may be easy with the other. How we use regex to do quality assurance on LLMs. - [Solution to a problem of Erdős](https://www.johndcook.com/blog/2024/12/09/erdos-pentagon/) - How many ways can you select six points in the plane so that every subset of three points forms the vertices of an isosceles triangle? - [Multiple angles and Osborn's rule](https://www.johndcook.com/blog/2024/12/07/multiple-angles/) - Application of Osborn's rule for converting trig identities into hyperbolic identities. Sine, cosine, and tangent of nθ. - [Coiled logarithmic graph](https://www.johndcook.com/blog/2024/12/09/coiled-logarithmic-graph/) - A coiled logarithmic plot squeezes more information into a limited space than a logarithmic scale alone. - [Efficiently transferring to a much higher orbit](https://www.johndcook.com/blog/2024/12/03/bi-elliptic-transfer/) - Comparing bi-elliptic transfer orbit and the Hohmann transfer orbit. The latter can be more efficient when the target orbit is far larger than the initial orbit. - [GPS satellite orbits](https://www.johndcook.com/blog/2024/11/15/gps-satellite-orbits/) - All GPS satellites are in circular orbits at the same altitude. Why is that? How were their orbits chosen? - [Rotating MacBook keys](https://www.johndcook.com/blog/2024/12/02/rotating-macbook-keys/) - Remapping MacBook keys so they work similar to keys on Windows and Linux. - [Make something and sell it](https://www.johndcook.com/blog/2010/01/22/make-something-and-sell-it/) - I've run across a couple podcasts this week promoting the radical idea that you should sell what you make. The latest Entrepreneurial Thought Leaders podcast features David Heineimeier Hansson's talk Unlearn Your MBA which he gave to a room full of MBA students. The latest Tech Nation podcast from IT Conversations is an interview with - [Trilinear coordinates](https://www.johndcook.com/blog/2022/11/30/trilinear-coordinates/) - A lot of concepts in classical geometry are most convenient to describe in trilinear coordinates. - [Circles to Circles](https://www.johndcook.com/blog/2020/09/23/circles-to-circles/) - Möbius transformations map lines and circles to lines and circles. Illustrating this with graphs and Python code. - [Three surprises with bc](https://www.johndcook.com/blog/2010/07/14/bc-math-library/) - The bc utility is a quirky but powerful calculator. It is a standard Unix utility and is also available for Windows. One nice feature of bc is ... - [Testing random number generators](https://www.johndcook.com/blog/2024/09/28/testing-rngs/) - If you're testing a RNG, the first thing you'd do is test the frequencies. Then you'd look at a goodness-of-fit test. Then there are more sophisticated tests. - [When do moments determine a function?](https://www.johndcook.com/blog/2024/11/04/moment-problem/) - When is a function determined by its moments? Given a set of moments, when is there a function that has these moments? Hausdorff, Stieltjes, and Hamburger problems. - [Multiple Frequency Shift Keying](https://www.johndcook.com/blog/2022/03/22/multiple-frequency-shift-keying/) - You've probably heard the sound of MFSK, a method of encoding digital data in an analog signal. - [The impossible puzzle](https://www.johndcook.com/blog/2024/11/04/the-impossible-puzzle/) - We construct the hardest jigsaw puzzle imaginable: as far as we know, it is unsolvable by any possible intelligence or computational power in the universe. - [Trigonometric interpolation](https://www.johndcook.com/blog/2024/11/05/trigonometric-interpolation/) - Fitting a sum of sines and cosines to data points using the fast Fourier transform FFT. - [Dogecoin anthem](https://www.johndcook.com/blog/2024/11/29/dogecoin-anthem/) - AI-generated Dogecoin anthem: To Da Moon. Audio MP3 and lyrics. - [Asymmetric generation / verification costs](https://www.johndcook.com/blog/2024/11/30/generation-verification-costs/) - Five examples of problems for which it is orders of magnitude easier to verify a solution than to generate a solution. - [Blogging pace](https://www.johndcook.com/blog/2024/11/28/blogging-pace/) - All is well. - [Perfect numbers](https://www.johndcook.com/blog/2024/11/20/perfect-numbers/) - Perfect numbers and their connections to Mersenne primes, triangular numbers, and binary sequences - [Food and Grace](https://www.johndcook.com/blog/2024/11/19/food-and-grace/) - I stumbled on a post on X this morning, a commentary on the photo of RFK eating food from McDonalds that has been making the rounds. This photo divides Puritans from Southerners. Puritans think because RFK Jr is on the side of health food he can never commit such a “sin.” Southerners think a rare - [Bluesky account](https://www.johndcook.com/blog/2024/11/18/bluesky-account/) - My Bluesky account and a bridge that will repost my Mastodon content to Bluesky. - [The mathematics of GPS](https://www.johndcook.com/blog/2024/11/16/the-mathematics-of-gps/) - Overview of the mathematics of determining your position by observing several satellites. - [Ramanujan's master theorem](https://www.johndcook.com/blog/2024/11/14/ramanujans-master-theorem/) - The theorem that Ramanujan used to prove some of his remarkable identities. - [Modal and temporal logic for computer security](https://www.johndcook.com/blog/2018/10/30/modal-logic-security/) - A brief summary of Security Logic, and modal and temporal logic for reasoning about security. - [Linear combination of sine and cosine as phase shift](https://www.johndcook.com/blog/2024/11/12/sin-cos-phase/) - Here's a simple calculation that I've done often enough that I'd like to save the result for my future reference and for the benefit of anyone searching on this. A linear combination of sines and cosines a sin(x) + b cos(x) can be written as a sine with a phase shift A sin(x + φ). - [Resolving a mysterious problem with find](https://www.johndcook.com/blog/2024/11/12/find-file-names/) - Resolving a problem when the find utility produces binary output when you expect text - [The Postage Stamp Problem](https://www.johndcook.com/blog/2024/11/10/the-postage-stamp-problem/) - I recently stumbled upon the Postage Stamp Problem. Given two relatively prime positive numbers a and b, show that any sufficiently large number N, there exists nonnegative integers x and y such that ax + by = N. I initially missed the constraint that x and y must be positive, in which result is well - [Impersonating an Edwardian math professor](https://www.johndcook.com/blog/2024/11/10/edwardian-math-prof/) - What would it be like if a time machine deposited a contemporary mathematician in a math department from 100 years ago? - [Maybe Copernicus isn't coming](https://www.johndcook.com/blog/2024/11/05/copernicus/) - Copernicus' model of the solar system is a canonical example of a simpler solution to a problem. But what if no Copernican-style simplification is coming? - [Average number of divisors](https://www.johndcook.com/blog/2024/10/09/average-number-of-divisors/) - Divisor count varies erratically but running average divisor count is much smoother and converges to log(n). - [Moments with Laplace](https://www.johndcook.com/blog/2024/11/04/moments-with-laplace/) - Relationship between moments of a function and the Laplace transform of a function. - [Computing Fourier series coefficients with the FFT](https://www.johndcook.com/blog/2021/03/20/fourier-series-fft/) - How to compute Fourier series coefficients using the FFT as implemented in Python's NumPy library. Resolving minor convention differences. - [Floating point: Everything old is new again](https://www.johndcook.com/blog/2024/11/01/floating-point/) - Large neural networks have created interest in low-precision arithmetic, fitting more numbers in memory. But low-precision memory brings back old problems. - [Eight-bit floating point](https://www.johndcook.com/blog/2018/04/15/eight-bit-floating-point/) - The idea of an 8-bit floating point number sounds kinda crazy at first, but they come in handy in applications where you don't need much precision and you're memory constrained. Comparing IEEE-like numbers and posit numbers. - [Alphabets and Unicode](https://www.johndcook.com/blog/2020/09/27/alphabets-and-unicode/) - There are several nice patterns to letters in ASCII, and they extend to other languages in Unicode, but with a few exceptions. - [Field of order 9](https://www.johndcook.com/blog/2022/09/21/field-of-order-9/) - Detailed example of arithmetic in a finite field of prime power order, namely 9, applied to constructing a Costas array - [Error correcting code from octonions](https://www.johndcook.com/blog/2021/12/20/octonion-ecc/) - The multiplication rules for octonions lead to a perfect code, the Hamming (8. 4. 4) code. - [Interview with Sacha Chua](https://www.johndcook.com/blog/2013/03/19/interview-with-sacha-chua/) - I spoke with Sacha Chua last week. We talked about entrepreneurship, Emacs, having eclectic interests, delegation, and more. J: I ran into you by searching on Emacs topics. When I look at your blog, I see that you do a lot of interesting things, but it's a little hard to get a handle on exactly - [How hard is constraint programming?](https://www.johndcook.com/blog/2024/10/31/how-hard-is-constraint-programming/) - Writing code using the Z3 SMT solver is different from typical programming, due to mixed programming models--not unlike CUDA for GPUs. Here's what to expect. - [Band-limited expansion](https://www.johndcook.com/blog/2024/10/28/band-limited-expansion/) - The band-limited expansion of a function, also known as sinc function expansion, has a lot of nice mathematical properties and is useful in numerical computing. - [Laplace transform inversion theorems](https://www.johndcook.com/blog/2024/10/25/laplace-transform-inversion/) - College classes can give a wrong impression of the Laplace transform, implying that it is either always east to invert or that it is useless. Both are false. - [Delay differential equations](https://www.johndcook.com/blog/2024/10/26/dde/) - Delay differential equations relate a function and its derivatives at the current point in time with their values in the past. - [Mellin transform and Riemann zeta](https://www.johndcook.com/blog/2024/10/25/mellin-transform-and-riemann-zeta/) - A relationship between the Mellin transform and the Riemann zeta function that is easy to prove. - [Pioneering work is ugly](https://www.johndcook.com/blog/2024/10/22/pioneering-work-is-ugly/) - Discussion of the quote "Pioneer work is clumsy." - [New Mersenne prime found](https://www.johndcook.com/blog/2024/10/21/new-mersenne-prime-found/) - New record sized prime, the 52nd known Mersenne prime - [Searching for Mersenne primes](https://www.johndcook.com/blog/2018/11/28/searching-for-mersenne-primes/) - The largest known primes are Mersenne primes because there is an efficient test for determining whether a Mersenne number is prime. - [Channel capacity of a telegraph](https://www.johndcook.com/blog/2024/10/19/channel-capacity-of-a-telegraph/) - Claude Shannon's famous paper A Mathematical Theory of Communication [1] includes an example saying that the channel capacity of a telegraph is log2 W where W is the largest real root of the determinant equation Where in the world did that come from? I'll sketch where the equation above came from, but first let's find - [Squares, triangles, and octal](https://www.johndcook.com/blog/2024/10/17/squares-triangles-and-octal/) - A quick and easy theorem about squares, triangular numbers, and base 8. - [RNG, PRNG, CSPRNG](https://www.johndcook.com/blog/2024/10/16/rng-prng-csprng/) - A pseudorandom number generator may have good statistical properties but be insecure. But a physical RNG with good statistical properties is probably secure. - [Triangle circle maximization problem](https://www.johndcook.com/blog/2024/10/16/triangle-circle-max/) - What triangle maximizes the product of the radii of its inscribed and circumscribed circles - [Width of mixture PDFs](https://www.johndcook.com/blog/2017/09/05/width-of-mixture-pdfs/) - Quantifying the width of a mixture of normal and Cauchy PDFs using FWHM - [Relating six properties of a triangle in one equation](https://www.johndcook.com/blog/2024/10/15/six-in-one/) - An equation relating the sides of a triangle to the inradius, circumradius, and perimeter. - [Tonal prominence in a leaf blower](https://www.johndcook.com/blog/2016/05/12/tonal-prominence-in-a-leaf-blower/) - Why a leaf blower sounds like a musical A. - [Why does FM sound better than AM?](https://www.johndcook.com/blog/2024/10/13/why-does-fm-sound-better-than-am/) - Frequency modulation (FM) is more robust to noise than amplitude modulation (AM) because static itself is primarily a form of amplitude modulation. - [Shifted reciprocal](https://www.johndcook.com/blog/2024/10/13/shifted-reciprocal/) - What happens to polar graph paper under the map w = 1/z or w = 1/(z - c)? - [Triangles to Triangles](https://www.johndcook.com/blog/2024/10/11/triangles-to-triangles/) - You can find a Mobius transformation to take any three points to any three points, but the transformation won't take a triangle to a triangle. - [Followship](https://www.johndcook.com/blog/2011/12/21/followship/) - Most so-called leadership is following, not leading. Following people around and making reports. Keeping notes, not setting direction. - [(1 − z) / (1 + z)](https://www.johndcook.com/blog/2024/09/26/mobius/) - The function f(z) = (1 − z)/(1 + z) comes up frequently in applications. This post gives several examples. ## Pages - [Clinical and Laboratory Standards Institute (CLSI) Stats](https://www.johndcook.com/blog/clsi-statistics/) - When CSLI says you should consult a statistician - [Statistics and Data Science](https://www.johndcook.com/blog/applied-statistics/) - Someways we can help your company: Bayesian analysis, Medical device design, Clinical trial design, Network analysis, DSP, Time series analysis and forecasting, Randomization, HIPAA de-identification, Regression, ... - [ASTM International and Statistics](https://www.johndcook.com/blog/astm-statistics/) - When the ASTM recommends you use a statistical consultant - [Data Privacy Consulting](https://www.johndcook.com/blog/data-privacy/) - Handling personal data? Meet your responsibilities for protecting privacy. Expert determination, deidentification and statistical disclosure control. - [HIPAA De-identification Expert](https://www.johndcook.com/blog/expert-hipaa-deidentification/) - Expert consultants with experience providing expert determination under the HIPAA Privacy Rule. Clients in insurance, law, medical devices, research, and more. - [Patient Safety and Quality Improvement Act (PSQIA) Expert Determination](https://www.johndcook.com/blog/psqia/) - Expert determination services for patient safety work products (PSWP) under the PSQIA. - [Blockchains and Cryptocurrency](https://www.johndcook.com/blog/crypto/) - Articles on blockchains and cryptocurrency - [Writing](https://www.johndcook.com/blog/writing/) - Places where you can find my writing, formal and informal. - [Applied mathematics](https://www.johndcook.com/blog/applied-math/) - Areas of applied mathematics our consultants have applied to solve business problems: Probability, Differential equations, Graphs and networks, Complex analysis, Numerical analysis, Filtering, Signal processing, etc. - [All possible scales](https://www.johndcook.com/blog/all-possible-scales/) - Book "All possible scales of three to eleven notes within the chromatic scale" by Pete White with audio files. - [Mnemonic trig diagrams](https://www.johndcook.com/blog/trig-mnemonic-diagrams/) - A couple diagrams to make it easier to remember trigonometric relationships and hyperbolic trig relationships. - [Fourier theorems under various conventions](https://www.johndcook.com/blog/fourier-theorems/) - There are several various ways to define the Fourier transform. This page shows how to convert between them and show the standard results with each convention. - [Cryptography](https://www.johndcook.com/blog/cryptography/) - Dive deep into modern cryptography: symmetric and asymmetric encryption, elliptic curves, secure hash functions, and a look at post-quantum cryptography. - [Twitter accounts](https://www.johndcook.com/blog/twitter_page/) - List of Twitter accounts that give daily tips in various areas of math, science, and software development - [Ways to subscribe](https://www.johndcook.com/blog/ways-to-subscribe/) - You can subscribe to this site by RSS. You can also find me on Twitter and LinkedIn. - [Reproducible Analysis](https://www.johndcook.com/blog/reproducible/) - Introduction to reproducible research, why it is important, and some tools for making it easier - [Diagram of distribution relationships](https://www.johndcook.com/blog/distribution_chart/) - Chart showing how probability distributions are related: which are special cases of others, which approximate which, etc. - [Greek letters in HTML, XML, TeX, and Unicode](https://www.johndcook.com/blog/greek_letters/) - How to write Greek letters in HTML, XML, TeX, and Unicode - [PowerShell Cookbook](https://www.johndcook.com/blog/powershellcookbook/) - Notes on how to do common tasks using PowerShell - [PowerShell gotchas](https://www.johndcook.com/blog/powershell_gotchas/) - Five of the biggest gotchas in using PowerShell: separating function arguments with spaces rather than commas, using backtick to escape special characters, ... - [Random number generation using C++ TR1](https://www.johndcook.com/blog/cpp_tr1_random/) - This article explains how to use the random number generation facilities in C++ using the TR1 (C++ Standards Committee Technical Report 1) extensions. - [Regex tips](https://www.johndcook.com/blog/regextip/) - Twitter account, articles, and books about regular expressions - [Regular expressions in Python and Perl](https://www.johndcook.com/blog/python_regex/) - Summary of how to work with regular expressions in Python. Compares Python with Perl and points out some gotchas. - [Regular expressions in R](https://www.johndcook.com/blog/r_language_regex/) - Notes on working with regular expressions in R. You can do in R what people usually do in languages like Perl, but it may take a while to discover how. - [Unicode resources](https://www.johndcook.com/blog/unicode/) - List of resources for working with Unicode - [Topological properties diagram](https://www.johndcook.com/blog/topology_diagram/) - Diagram showing the implications between various topological spaces - [Technical notes on math and software](https://www.johndcook.com/blog/notes/) - Notes on math and software: probability, approximations, special functions, regular expressions, Python, C++, R, etc. - [Publications](https://www.johndcook.com/blog/articles/) - Publications in Bayesian statistics, numerical analysis, clinical trial design, and nonlinear partial differential equations by John Cook - [Cauchy distribution parameter estimation](https://www.johndcook.com/blog/cauchy_estimation/) - Article showing how to estimate the location parameter of a Cauchy distribution from data - [Big Logic](https://www.johndcook.com/blog/applied-logic/) - As systems get larger and more complex, we need new tools to test whether these systems are correctly specified and implemented. - [Accented letters in HTML, TeX, and Microsoft Word](https://www.johndcook.com/blog/accented_letters_page/) - This page explains the patterns behind how HTML, TeX, and Microsoft Word represent accented letters. - [Software](https://www.johndcook.com/blog/software/) - Software that I have written or written about: Numerical computing, Clinical trial design and conduct, PowerShell, random number generation - [The Wilson-Hilferty approximation to the Poisson distribution](https://www.johndcook.com/blog/wilson_hilferty/) - The central limit theorem gives a normal approximation to a Poisson distribution, but it is possible to create a more accurate normal approximation. - [Use information theory to clarify and quantify goals](https://www.johndcook.com/blog/applied-information-theory/) - Information theory can make fuzzy ideas precise and quantified, helping you see what needs to be done next. - [Let's talk](https://www.johndcook.com/blog/contact/) - Contact info for John D. Cook Consulting. Phone, email, Twitter, etc. Reach out for a free consultation on how we can help your business. - [Numerical computation](https://www.johndcook.com/blog/numerical-computation/) - Consulting in numerical analysis and numerical computing - [Mathematics of Radio](https://www.johndcook.com/blog/radio/) - Signal processing, encoding, modulation, and other mathematical aspects of radio - [Deidentification, anonymization, and pseudonymization](https://www.johndcook.com/blog/pseudonymization/) - What is the difference between deidentification, anonymization and pseudonymization? Some use these words interchangeably, some have various distinctions in mind. - [Pullbacks](https://www.johndcook.com/blog/pullbacks/) - Products, kernels, intersections, inverse images, and equalizers are all examples of pullbacks. - [Presentations](https://www.johndcook.com/blog/presentations/) - Presentations I have given at various conferences, companies, and universities. Topics include software development, math, statistics, clinical trials, etc. - [C#](https://www.johndcook.com/blog/c-sharp/) - C# resources, especially for mathematical computing - [Dynamical systems & chaos](https://www.johndcook.com/blog/dynamical/) - A curated list of articles on dynamical systems and chaos - [Special numbers](https://www.johndcook.com/blog/special-numbers/) - Bell, Bernouli, Partition, Heegner, Sterling, Harmonic, Tetrahedral, Catalan, Fibonacci, and Lucas - [Benford's law](https://www.johndcook.com/blog/benfords-law/) - This page is an index to articles on the site about Benford's law. Benford's law and probability distributions Pareto distribution Weibull distribution Cauchy distribution Benford's law and number theory Leading digits of powers of two Gelfand's question Leading digits of factorials When Benford's law is exact Benford's law and computer science Collatz 3n+1 conjecture Benford's - [Newsletter](https://www.johndcook.com/blog/newsletter/) - An occasional newsletter highlighting a few posts from my blog and sometimes sharing a little about what I've been up to. - [Unraveling Strings in Visual C++](https://www.johndcook.com/blog/cplusplus_strings/) - How to work in C++ with strings of type char*, wchar_t*, LPCTSTR, BSTR, CString, basic_string, _bstr_t, CComBSTR, etc. - [Applied category theory](https://www.johndcook.com/blog/applied-category-theory/) - Category theory can be very useful, but you don't apply it the same way you might apply other areas of math. - [Math.h in POSIX, ISO, and Visual Studio](https://www.johndcook.com/blog/math_h/) - Chart showing the differences between Linux (POSIX) implementations of math.h and the implementation in Visual Studio on Windows - [Getting started with Emacs on Windows](https://www.johndcook.com/blog/emacs_windows/) - Notes on getting started with Emacs on Windows. Many things work the same across platforms, but here are a few specifics for Windows. - [RSS feed](https://www.johndcook.com/blog/rss-feed/) - RSS feed for johndcook.com - [Help making R part of your computing environment](https://www.johndcook.com/blog/applied-r-programming-language-help/) - The R language can be as quirky as it is powerful. Need help making R play well with others? - [Math Symbols](https://www.johndcook.com/blog/math-symbols/) - This page contains the math-related posts from my short-lived blog Symbolism. The non-mathematical posts are collected here. Table of contents: Weierstrass p function Rotated T's Cyrillic letters in math Planck's constant Epi and mono arrows There exists Long S Equals Aleph Weierstrass p function Mathematicians don't often change the style of letters to denote special - [Quantitative Finance and Risk Analysis](https://www.johndcook.com/blog/quantitative-finance-risk-analysis/) - Expert consultant in forecasting and managing risk using probability and other mathematical tools. - [Miscellaneous Symbols](https://www.johndcook.com/blog/miscellaneous-symbols/) - This page contains miscellaneous posts from my short-lived blog Symbolism. The math-related posts are collected here. Table of contents: Bluetooth Victory sign In hoc signo vinces APL Ankh Caduceus Eth and thorn Ichthys Bluetooth The Bluetooth wireless communication protocol is named in honor of Harald Bluetooth who united rival Danish tribes into a single - [Browser cookies and privacy laws](https://www.johndcook.com/blog/cookies-privacy-and-laws/) - Privacy and legal considerations regarding 1st and 3rd party cookies. EU law, US state law, HIPAA - [Privacy risks](https://www.johndcook.com/blog/dp9/) - Understand privacy risks. Not just avoiding fines. Learn how a data breach can hurt you and learn how to protect yourself and your firm. John D. Cook Consulting. - [State privacy laws](https://www.johndcook.com/blog/dp5/) - Most US states have privacy laws or are working on them. Sow is your company affected and learn how can you comply. John D. Cook Consulting & Expert Determination. - [IEEE floating-point exceptions in C++](https://www.johndcook.com/blog/ieee_exceptions_in_cpp/) - How to handle floating point exceptions such as 1.#IND, 1.#INF, nan, and inf - [Federal Trade Commission Health Breach Notification Rule](https://www.johndcook.com/blog/ftc-hbnr/) - Responsibility for reporting a breach of security within 60 days to data subjects, the FTC, and media. - [Real World Data](https://www.johndcook.com/blog/real-world-data/) - What does "real world data" mean? What are the legal and regulatory issues around using real world data? - [Data breaches and incidents](https://www.johndcook.com/blog/dp7/) - Are you ready for a data breach? Learn how to protect privacy and stay compliant if the worst happens. John D. Cook Expert Determination and privacy consulting. - [Convert between real and complex Fourier series](https://www.johndcook.com/blog/real-and-complex-fourier/) - Conversion between real and complex Fourier series representations is fairly simple but error prone. Formulas for conversion for reference. - [Services](https://www.johndcook.com/blog/services-2/) - Companies come to us for help data analysis and data privacy. Clients have included Amazon, Google, Microsoft, law firms, start-ups, and smaller businesses. - [Web analytics](https://www.johndcook.com/blog/web-analytics/) - Resources for companies concerned about web analytics, efficient and reliable testing, and complying with data privacy requirements - [Solving quadratic congruences](https://www.johndcook.com/blog/quadratic_congruences/) - Notes on how to solve quadratic congruences. Most textbooks outline how it can be done, but don't go into the detail that these notes do. - [Client-side versus server-side testing](https://www.johndcook.com/blog/client-side-server-side/) - There are two different ways to test a page. The most common approach, client-side testing, sends all users the same the page, but then JavaScript running on the client loads changes that alter the page for some users. This has the advantage of being simple to set up. The other way is server-side testing. With - [Vermont Privacy Bill](https://www.johndcook.com/blog/vermont-hb-121/) - Vermont's House Bill 121, if signed by the governor, will resemble other state privacy bills but will broaden the definition of biometric identifiers. - [Statistical computation consulting](https://www.johndcook.com/blog/statistical_consulting/) - Consulting support for statistical computing and software integration - [Endorsements](https://www.johndcook.com/blog/endorsements/) - Read what our clients have to say about working together, ways we've helped them solve challenging problems. - [Central Limit Theorems](https://www.johndcook.com/blog/central_limit_theorems/) - Generalizations of the classical central limit theorem - [HIPAA considerations for Google Analytics and Alternatives](https://www.johndcook.com/blog/hipaa-and-analytics/) - We can help you understanding how Google's GA4 and other analytics platforms interact with personal information. - [Web analytics and statistical bias](https://www.johndcook.com/blog/web-analytics-and-statistical-bias/) - How might web analytics give you biased data? What can you do to mitigate the bias? - [Experimental design](https://www.johndcook.com/blog/design/) - Expert guidance in designing and conducting experiments. Maximize learning while satisfying regulatory and ethical constraints. - [Applied complex analysis](https://www.johndcook.com/blog/applied-complex-analysis/) - So-called "complex" analysis can greatly simplify a problem. It's complex in the sense of complex numbers, not in the sense of being complicated. - [Randomization that will stand up in court](https://www.johndcook.com/blog/defensible-randomization/) - Not only do randomization procedures need to be fair, they need to be defensible in court if necessary. - [Random number generation in Python](https://www.johndcook.com/blog/python_random_number_generation/) - Notes on random number generation in Python, including links to code for distributions not directly supported in the standard library - [Collaborators and Advisers](https://www.johndcook.com/blog/team/) - Consulting team. Overlapping and complementary skills. Solid theoretical understanding and practical implementation. - [PhD experts in math, statistics, and computer science](https://www.johndcook.com/blog/phd-math-stats-cs/) - Expert consultants in mathematics, statistics, and computer science. PhDs from top schools and decades of practical experience. - [Save money on A/B testing by asking the right question](https://www.johndcook.com/blog/significant-difference/) - Sometimes you want to know whether A is substantially better than B, which can be answered sooner than whether A is better than B. Stop early, save money. - [Illinois Biometric Information Privacy Act](https://www.johndcook.com/blog/illinois-bipa/) - The Illinois Biometric Information Privacy Act (740 ILCS 14, a.k.a BIPA) was signed into law in 2008. It is the most stringent biometric state privacy law in the US, and yet many categories of biometric data are explicitly excluded as described below. You can find the text of the law here. One unique aspect of - [EPA Engine Testing Requirements](https://www.johndcook.com/blog/epa-engine-testing-requirements/) - Federal regulations for engine testing repeatedly say "consult a statistician." We can help - [Engineering statistics](https://www.johndcook.com/blog/applied-engineering-statistics/) - Help with applications of statistics to engineering: error estimation, reliability, experimental design, etc. - [Time series analysis and forecasting](https://www.johndcook.com/blog/forecasting/) - Expert help making sense of a predicting the output of noisy data over time - [Response surface models](https://www.johndcook.com/blog/response-surface/) - What is a response surface model (RSM)? How do I use response surface models to quickly determine what inputs are more important to optimizing my system? - [Biomathematics and Biostatistics](https://www.johndcook.com/blog/expert-consultant-in-biomathematics-and-biostatistics/) - Expert consultants in biostatistics and biomathematics. Experience working with pharma, biotech, and research institutions. - [Statistical OSINT](https://www.johndcook.com/blog/statistical-osint/) - How statistical techniques are complementary to conventional OSINT techniques - [Independent reviewer statistician](https://www.johndcook.com/blog/independent-statistician/) - Independent statisticians available to review or reconstruct statistical analyses. - [Expert Testimony](https://www.johndcook.com/blog/expert-testimony/) - Consultant helping lawyers, judges, and juries understand subtle ideas in mathematics, especially probability and data analysis - [Kalman filters and tracking](https://www.johndcook.com/blog/applied-kalman-filtering/) - Kalman filters combine observation and prediction to get the best of both worlds, making optimal use of noisy data. - [Differential equations](https://www.johndcook.com/blog/partial-differential-equations/) - Experts in partial differential equations, numerical solutions, and applications - [Putting probability to work](https://www.johndcook.com/blog/applied-probability/) - Probability is useful everywhere. The future is uncertain, at least in detail, and probability gives us a way to proceed in the face of uncertainty. - [Data Privacy FAQ](https://www.johndcook.com/blog/data-privacy-faq/) - Learn about data privacy as it applies to your business with our FAQ. John D. Cook Consulting Expert Determination and statistician expert witness. - [Data privacy techniques](https://www.johndcook.com/blog/dp8/) - Learn the best techniques to protect privacy in your company, stay compliant, and avoid fines. John D. Cook Expert Determination and privacy consulting. - [GDPR](https://www.johndcook.com/blog/dp6/) - Learn how GDPR and its implications affect you and your business. It's not just for Europe. John D. Cook Expert Determination and privacy consulting. - [Cryptography](https://www.johndcook.com/blog/dp4/) - Learn how cryptographic hashing may or may not protect your privacy. See what to do if not. John D. Cook Consulting Expert Determination and statistician expert witness. - [Artificial intelligence and natural language processing](https://www.johndcook.com/blog/dp3/) - Artificial Intelligence and LLMs are shaking up the privacy landscape. Is your business considering privacy implications? John D. Cook Consulting & Expert Determination. - [HIPAA, Expert Determination, and Safe Harbor](https://www.johndcook.com/blog/dp2/) - Learn about HIPAA Expert Determination and Safe Harbor as it applies to your business with our FAQ. John D. Cook Consulting provides Expert Determination services. - [General data privacy questions](https://www.johndcook.com/blog/dp1/) - 1.1. What's wrong with the nothing-to-hide argument? Why should anyone care about privacy, especially people who feel they have nothing to hide? One problem with this is that it assumes that there are no false positives. This assumes that strangers who make inferences about you based on your personal data – law enforcement, insurance companies, - [The 18 HIPAA Safe Harbor identifiers explained](https://www.johndcook.com/blog/hipaa-identifiers-explained/) - Summarizing and explaining the 18 rules for HIPAA Safe Harbor (and the so-called 19th rule). What are the rules and their rationale? Alternative to Safe Harbor. - [Online privacy](https://www.johndcook.com/blog/dp10/) - There are special considerations for online privacy. Learn about browser tracking and how you can protect yourself and your company. John D. Cook Consulting. - [Finite fields](https://www.johndcook.com/blog/finite-fields/) - Finite fields, also known as Galois fields, are algebraic fields with a finite number of elements. These fields are surprisingly useful in application. - [Distributions in SciPy](https://www.johndcook.com/blog/distributions_scipy/) - Notes on probability distribution functions in Python using SciPy - [Counting selections with replacement](https://www.johndcook.com/blog/select_with_replacement/) - Calculating the number of possible selections with replacement from a set - [Binomial coefficients](https://www.johndcook.com/blog/binomial_coefficients/) - Generalizations of the basic definition of binomial coefficients. Arguments can be non-integers, even complex numbers. - [Relative error in normal approximations](https://www.johndcook.com/blog/relative_error_normal_approx/) - Most discussions of normal distribution approximations focus on absolute error, but sometimes relative error is more important and more subtle - [Notes on Spherical Trigonometry](https://www.johndcook.com/blog/spherical_trigonometry/) - Brief summary of spherical trigonometry, working with triangles on the surface of a sphere - [Moments: raw, centralized, and standardized](https://www.johndcook.com/blog/moments/) - Definitions of raw moments, central moments, and standardized moments. Equations for how they relate to each other. - [Mentally computing common functions](https://www.johndcook.com/blog/mental-functions/) - How to mentally approximate logs base 2, e, and 10; trig functions; square roots; 10^x and e^x; and the gamma function. - [Gamma and related functions in SciPy](https://www.johndcook.com/blog/gamma_python/) - Summary of how to compute the gamma function and related functions in Python using SciPy - [Fundamental rectangles for Jacobi elliptic functions](https://www.johndcook.com/blog/fundamental-rectangles/) - Plots of the fundamental rectangles for the 12 Jacobi elliptic functions. - [Error in the Poisson approximation to the binomial distribution](https://www.johndcook.com/blog/poisson_approx_to_binomial/) - Notes on the error in approximating a binomial distribution by a Poisson distribution - [Error in the normal approximation to the Poisson distribution](https://www.johndcook.com/blog/normal_approx_to_poisson/) - Notes on the error in approximating a Poisson distribution by a normal distribution - [Error in the normal approximation to the binomial distribution](https://www.johndcook.com/blog/normal_approx_to_binomial/) - Notes on the error in approximating a binomial distribution with a normal distribution - [Details for error bound on normal approximation to the Poisson distribution](https://www.johndcook.com/blog/berry_esseen_poisson/) - It is well known how to approximate a Poisson distribution with a normal distribution, but the error in this approximation is harder to find - [Conjugate prior relationships](https://www.johndcook.com/blog/conjugate_prior_diagram/) - Diagram showing conjugate prior relationships, which distributions are conjugate priors for which sampling distributions - [Camp-Paulson normal approximation to the binomial distribution](https://www.johndcook.com/blog/camp_paulson/) - A better normal approximation to the binomial distribution than the one given by the central limit theorem - [Big-O and related notation](https://www.johndcook.com/blog/asymptotic_notation/) - Explanation of big-oh and other kinds of asymptotic notation. Notes on how they're used in math and computer science. - [Accurately computing running variance](https://www.johndcook.com/blog/standard_deviation/) - How to compute sample variance (standard deviation) as samples arrive sequentially, avoiding numerical problems that could degrade accuracy. - [A literate program to compute the inverse of the normal CDF](https://www.johndcook.com/blog/normal_cdf_inverse/) - Code to compute the inverse of the normal (Gaussian) distribution - [American Privacy Rights Act of 2024](https://www.johndcook.com/blog/apra/) - The American Privacy Rights Act was proposed in April of 2024. It would preempt state privacy laws, and cover more entities and more kinds of data than HIPAA. - [Texas Data Privacy and Security Act](https://www.johndcook.com/blog/tdpsa/) - Data deidentification under the Texas Data Privacy and Security Act (TDPSA). What is required? How do you know whether you've done enough? - [Differential Privacy](https://www.johndcook.com/blog/differential-privacy/) - Explore the benefits of differential privacy, privacy protection with a solid mathematical foundation. Safely answer queries based on data unsafe to share. - [How to memorize a Bitcoin private key](https://www.johndcook.com/blog/memorize-bitcoin-key/) - Two approaches to converting a Bitcoin private key, a 256-bit number, into a memorable sequence of words. - [Data Privacy SME](https://www.johndcook.com/blog/data-privacy-sme/) - Subject matter experts in the technical side of data privacy: statistical disclosure control, HIPAA deidentification, differential privacy, information theory - [Big data](https://www.johndcook.com/blog/big_data/) - Enormous data sets often consist of enormous numbers of small sets of data, and they fit together in complicated ways. - [HIPAA Privacy Rule and Security Rule](https://www.johndcook.com/blog/hipaa-privacy-security/) - Differences between HIPAA's Privacy Rule & Security Rule. Where expert determination fits in. We partner with law firms, insurance companies, universities etc. - [Security incident / data breach response](https://www.johndcook.com/blog/data-incident-breach-response/) - When you have a security incident or a data breach, our experience team helps you evaluate privacy implications, such as whether the data is identifiable. - [GDPR Pseudonymisation](https://www.johndcook.com/blog/gdpr/) - Navigate GDPR with expert pseudonymisation advice. Ensure compliance & data utility. We partner with law firms to provide expert de-identification consulting. - [California Consumer Privacy Act (CCPA)](https://www.johndcook.com/blog/ccpa/) - Navigate data privacy under CCPA with expert determination analogous to HIPAA, as described in amendment AB 713 to the CCPA. - [Awk regular expressions](https://www.johndcook.com/blog/awk-regular-expressions/) - Regular expression features supported by awk and gawk. How these features compare to POSIX, GNU, sed, and grep. - [Applied linear algebra](https://www.johndcook.com/blog/applied-linear-algebra/) - Linear algebra is everywhere. Even problems that are not linear and not algebraic boil down to linear algebra. - [Online calculators](https://www.johndcook.com/blog/online-calculators/) - Calculators for interpolation, sample size calculation, geodesy, music and acoustics, science and engineering, typography, ... - [Decimal-coded hexadecimal](https://www.johndcook.com/blog/decimal-coded-hex/) - Encoding pairs of hexadecimal digits in triples of decimal digits in a way that can be done easily in your head. - [Test](https://www.johndcook.com/blog/test/) - Here is a GTM link. [contact-form-7 id="28048" title="Contact Form"] For daily tips on regular expressions, follow @RegexTip on Twitter. We hold these truths ... Click me [contact-form-7 id="28049" title="Slim Contact Form"] a ↔︎ b a ↔ b - [Random number generator testing](https://www.johndcook.com/blog/rng-testing/) - Random number generator test services. We test RNGs using the standard test suites: PractRand, TestU01 (BigCrush), DIEHARD(ER), NIST SP 800-22. - [Bayesian networks and causal inference](https://www.johndcook.com/blog/bayesian-networks-causal-inference/) - Bayesian networks are a tool for visualizing relationships between random variables and guiding computations on these related variables. - [Upper and lower bounds for the normal distribution function](https://www.johndcook.com/blog/norm-dist-bounds/) - Upper and lower bounds on the tail probabilities for normal (Gaussian) random variables. This page proves simple bounds and then states sharper bounds based on bounds on the error function given in Abramowitz and Stegun. - [Seven normal forms in logic](https://www.johndcook.com/blog/seven-normal-forms-in-logic/) - This post discusses seven normal forms: Negation normal form Conjunctive normal form Disjunctive normal form Algebraic normal form Prefix normal form Skolem normal form Blake canonical form The photo above is Thoralf Skolem, Norwegian mathematician and author of Skolem normal form. Negation normal form The only symbols in negation normal form are conjunction (∧), disjunction - [Psychoacoustics consulting](https://www.johndcook.com/blog/psychoacoustics-consulting/) - Psychoacoustics is the science of how humans perceive sound. It can be complex because human hearing and perception is complex. - [Explaining probability to a jury](https://www.johndcook.com/blog/explaining-probability-to-a-jury/) - A panel of jurors is unlikely to contain many people who understand probability, but understanding probability may be critical to a fair trial. - [Decision theory: Making good decisions under uncertainty](https://www.johndcook.com/blog/decision-theory/) - The purpose of analyzing data is to make decisions, not to estimate parameters. Decision theory aims directly at making the best decisions under uncertainty. - [Data mining and privacy](https://www.johndcook.com/blog/data-mining-and-privacy/) - How can you extract valuable information from data while preserving individual privacy? We can help you do that. - [Bioinformatics, Biostatistics, and Biomathematics](https://www.johndcook.com/blog/bioinformatics-biostatistics-and-biomathematics/) - Describing the fuzzy boundaries between bioinformatics, biostatistics , and biomathematics - [Moving data between R and Excel via the clipboard](https://www.johndcook.com/blog/r_excel_clipboard/) - These notes explain how to move data between R and Excel and other Windows applications via the clipboard. - [Student-t random number generator](https://www.johndcook.com/blog/python_student_t_rng/) - Generating random samples from a Student t probability distribution - [Stand-alone Python implementation of Phi inverse](https://www.johndcook.com/blog/python_phi_inverse/) - Self-contained Python code for computing the inverse of Phi, the CDF of a standard normal probability distribution - [Stand-alone Python error function erf(x)](https://www.johndcook.com/blog/python_erf/) - Self-contained Python code for computing erf(x), the error function - [Stand-alone code for numerical computing](https://www.johndcook.com/blog/stand_alone_code/) - Small, self-contained snippets of code for scientific computing. Implements mathematical functions that might be missing from your language or library. - [Stand-alone C++ implementation of Φ(x)](https://www.johndcook.com/blog/cpp_phi/) - Self-contained C++ code for computing Phi(x), the distribution function (CDF) of a standard normal probability - [Stand-alone C++ implementation of the error function erf(x)](https://www.johndcook.com/blog/cpp_erf/) - Self-contained C++ code for computing erf(x), the error function - [Stand-alone C++ implementation of Phi inverse](https://www.johndcook.com/blog/cpp_phi_inverse/) - Self-contained C++ code for computing the inverse of Phi, the CDF of a standard normal probability distribution - [Stand-alone C++ code for log(1+x)](https://www.johndcook.com/blog/cpp_log_one_plus_x/) - When x is small, directly computing log(1+x) can have huge relative error. Self-contained C++ code for accurately computing log(1+x), especially for small x - [Stand-alone C++ code for exp(x) - 1](https://www.johndcook.com/blog/cpp_expm1/) - Self-contained C++ code for accurately computing exp(x) - 1, especially for small arguments where direct computation is not accurate - [Stand-alone C# code for Φ(x)](https://www.johndcook.com/blog/csharp_phi/) - Self-contained code C# for computing Phi(x), the distribution function (CDF) of a standard normal probability - [Stand-alone C# code for the error function erf(x)](https://www.johndcook.com/blog/csharp_erf/) - Self-contained C# code for computing erf(x), the error function - [Stand-alone C# code for Phi inverse](https://www.johndcook.com/blog/csharp_phi_inverse/) - Self-contained C# code for computing the inverse of the CDF of a standard normal probability distribution - [Stand-alone C# code for log(1+x)](https://www.johndcook.com/blog/csharp_log_one_plus_x/) - When x is small, directly computing log(1+x) can have huge relative error. Self-contained C# code for accurately computing log(1+x), especially for small x - [Stand-alone C# code for exp(x) - 1](https://www.johndcook.com/blog/csharp_expm1/) - Self-contained C# code for accurately computing exp(x) - 1, especially for small arguments where direct computation is not accurate - [Random number generation in C++](https://www.johndcook.com/blog/cpp_random_number_generation/) - Notes on random number generation in C++, including links to code for distributions not directly supported in the standard library - [R language for programmers](https://www.johndcook.com/blog/r_language_for_programmers/) - Some things about the R programming language that programmers coming from other languages are likely to trip over. - [Probability distributions in R](https://www.johndcook.com/blog/distributions_r_splus/) - Notes on probability distribution functions in R: notation conventions, parameterizations, etc. - [Probability Distributions in Mathematica](https://www.johndcook.com/blog/distributions_mathematica/) - Notes on probability distribution functions in Mathematica - [Error in the normal approximation to the gamma distribution](https://www.johndcook.com/blog/normal_approx_to_gamma/) - Notes on the error in approximating a gamma distribution by a normal distribution - [Error in the normal approximation to the beta distribution](https://www.johndcook.com/blog/normal_approx_to_beta/) - Notes on the error in the normal distribution approximation to a beta distribution - [Computing the distance between two locations on Earth from coordinates](https://www.johndcook.com/blog/python_longitude_latitude/) - Python code for computing the distance between two points from their longitude and latitude - [Computing the distance between two locations from coordinates in F#](https://www.johndcook.com/blog/fsharp_longitude_latitude/) - F# code for computing the distance between two points from their longitude and latitude - [Computing skewness and kurtosis in one pass](https://www.johndcook.com/blog/skewness_kurtosis/) - How to calculate skewness and kurtosis in only one pass through your data - [C++ code for gamma and log gamma](https://www.johndcook.com/blog/cpp_gamma/) - Self-contained C++ code for computing the gamma function and the log of the gamma function - [C++ code for computing log factorial](https://www.johndcook.com/blog/cpp_log_factorial/) - Self-contained C++ code for computing the log of the factorial function - [C# code for gamma and log gamma](https://www.johndcook.com/blog/csharp_gamma/) - Self-contained C# code for computing the gamma function and the log gamma function - [C# code for computing log factorial](https://www.johndcook.com/blog/csharp_log_factorial/) - Self-contained C# code for computing the log of the factorial function - [About](https://www.johndcook.com/blog/about-2/) - We help your company solve problems with data privacy and applied mathematics. - [Randomization](https://www.johndcook.com/blog/randomization/) - Validating randomization procedures: random sampling, efficiently generating random numbers, transforming random numbers to have the desired distribution, testing software. - [A knight’s tour magic square](https://www.johndcook.com/blog/magic_knight/) - A magic square given by numbering the moves in a knight's tour of a chess board. Created by Leonard Euler. - [The difference between an unbiased estimator and a consistent estimator](https://www.johndcook.com/blog/bias_consistency/) - Notes on the difference between an unbiased estimator and a consistent estimator. People often confuse these two concepts. - [Stand-alone Python implementation of Φ(x)](https://www.johndcook.com/blog/python_phi/) - Self-contained Python code for computing Phi(x), the distribution function (CDF) of a standard normal probability - [Stand-alone Python code for log(1+x)](https://www.johndcook.com/blog/python_log_one_plus_x/) - When x is small, directly computing log(1+x) can have huge relative error. Self-contained Python code for accurately computing log(1+x), especially for small x - [Stand-alone Python code for exp(x) - 1](https://www.johndcook.com/blog/python_expm1/) - Self-contained Python code for accurately computing exp(x) - 1, especially for small arguments where direct computation is not accurate - [Python resources](https://www.johndcook.com/blog/python-resources/) - Miscellaneous resources: Moving to the Python scientific computing stack Bessel functions in SciPy Gamma and related functions in SciPy Distributions in SciPy Python counterparts for C math functions Xonsh Julia for Python programmers Scientific computing in Python Benchmarking Python, R, C++, etc. IEEE floating point arithmetic in Python Basics of Pweave The SciPy and NumPy - [Cauchy random number generator](https://www.johndcook.com/blog/python_cauchy_rng/) - Python code for generating random numbers with a Cauchy distribution - [Bessel functions in SciPy](https://www.johndcook.com/blog/bessel_python/) - Overview of the support for Bessel functions in the SciPy Python library - [Notes on Unicode in Emacs](https://www.johndcook.com/blog/emacs_unicode/) - Notes on working with Unicode characters in Emacs - [Probability distributions in Excel 2007](https://www.johndcook.com/blog/distributions_excel/) - An overview of probability distribution functions in Excel - [How to calculate binomial coefficients](https://www.johndcook.com/blog/computing_binomial_coefficients/) - Notes on how to calculate binomial coefficients, avoiding numerical problems with overflow or underflow - [Adult heights and mixture distributions](https://www.johndcook.com/blog/mixture_distribution/) - Illustrating mixtures of probability distributions with the example of adult heights - [Modes of convergence](https://www.johndcook.com/blog/modes_of_convergence/) - Diagram showing the relations between various modes of convergence in real analysis: convergence almost everywhere, convergence in measure, etc. - [Identities for gamma and related functions](https://www.johndcook.com/blog/gamma_identities/) - Diagram of identities satisfied by the gamma function and related functions - [Regular expressions in PowerShell and Perl](https://www.johndcook.com/blog/powershell_perl_regex/) - Notes on working with regular expressions in PowerShell, comparing PowerShell's features with those of Perl - [Regular expressions in Mathematica](https://www.johndcook.com/blog/mathematica_regex/) - Notes on working with regular expressions in Mathematica - [Comparing regular expressions in Perl, Python, and Emacs](https://www.johndcook.com/blog/regex-perl-python-emacs/) - Comparing the syntax features of regular expressions in Perl, Python, and Emacs. Several other languages mostly overlap with Python. - [C++ TR1 regular expressions](https://www.johndcook.com/blog/cpp_regex/) - Regular expression support in C++ as supported in TR1 (technical report 1) - [Medical device startup consulting](https://www.johndcook.com/blog/applied-medical-devices/) - Expert help with mathematical modeling and statistical analysis for medical device startups. - [Signal processing](https://www.johndcook.com/blog/digital-signal-processing-and-time-series-analysis/) - Many problems boil down to separating signal from noise, though what is "signal" and what is "noise" depends on context. - [Bayesian analysis consulting](https://www.johndcook.com/blog/bayesian-consulting/) - Expert consultants in Bayesian statistics, mathematical modeling, and data analysis. Take advantage of the power and flexibility of Bayesian analysis. - [Category theory definition dependencies](https://www.johndcook.com/blog/category_theory/) - Diagram showing how the definitions of various terms in category theory depend on each other - [Category Relationships in Mathematical Physics](https://www.johndcook.com/blog/geroch/) - Diagram showing the relationships between mathematical categories that arise in mathematical physics - [Topological vector spaces](https://www.johndcook.com/blog/topological_vector_spaces/) - Diagram showing the relationships between various kinds of topological vector spaces - [Relations between special functions](https://www.johndcook.com/blog/special_function_diagram/) - A diagram showing how various mathematical special functions relate to each other - [Common Math Symbols in HTML, TeX, and Unicode](https://www.johndcook.com/blog/math_symbols/) - The symbols that come up frequently in math and describe how to represent them in TeX, HTML, XML, and Unicode. - [Logic symbols](https://www.johndcook.com/blog/logic-symbols/) - Common, and some not-so-common, symbols used in logic - [Universal properties](https://www.johndcook.com/blog/universal-properties/) - Universal property definitions all follow the same pattern. Here we give multiple examples. - [Applied linear regression](https://www.johndcook.com/blog/applied-linear-regression/) - Linear regression is much more than curve-fitting. It gives you not just parameters but estimates of the uncertainty regarding these parameters. - [Symbol jargon](https://www.johndcook.com/blog/symbol-jargon/) - Symbol pronunciation jargon - [Python counterparts for C math functions](https://www.johndcook.com/blog/math_h_to_python/) - Python counterparts for C math functions - [Double exponential integration](https://www.johndcook.com/blog/double_exponential_integration/) - Notes on the double exponential integration , a very efficient numerical integration algorithm - [C# code for generating Poisson random values](https://www.johndcook.com/blog/csharp_poisson/) - Self-contained C# code for generating random numbers with a Poisson distribution - [Formal validation methods](https://www.johndcook.com/blog/applied-formal-methods/) - Informal logic works well at a small scale, but is not adequate for large complex systems. Formal methods to the rescue! - [Troubleshooting Sweave](https://www.johndcook.com/blog/troubleshooting_sweave/) - Notes on common problems with Sweave (tool for embedding R code in LaTeX) and how to fix them - [Initial objects, final objects, and zeros](https://www.johndcook.com/blog/initial-final-objects/) - Initial and final objects are simple to define, but they play out differently in different categories. These notes walk through several examples. - [Moving to the numerical Python stack](https://www.johndcook.com/blog/numerical-python-expert/) - Numerical computing of all kinds—data analysis, simulation, visualization, etc.—is moving to Python and its scientific computing stack. Why is this? Do you want to move your company to Python? If so, would you like some help? Why the Python stack One reason people are moving to Python is convenience. Although licenses for the "Three M's" - [Applied number theory](https://www.johndcook.com/blog/applied-number-theory/) - Number theory has numerous applications. The best known is cryptography, but there are many others. - [Study replication](https://www.johndcook.com/blog/study-replication/) - Reproducing the statistical analysis behind a scientific study, verifying that the analysis was carried out correctly and as reported - [Adaptive clinical trial design](https://www.johndcook.com/blog/clinical-trial-design/) - Experience in designing and implementing adaptive clinical trials using Bayesian methods. - [Sweave: First steps toward reproducible analyses](https://www.johndcook.com/blog/coombes/) - Introduction to Sweave, software that lets you embed R code in a LaTeX file. Lets you include the code and/or the results of executing the code in your final LaTeX output - [Agile Software Forecasting | Estimating & Planning Consultants](https://www.johndcook.com/blog/agile-software-forecasting/) - Software development is rife with uncertainty. It's common for a software project to be 100% over budget or schedule, and often both. This can only be tolerated when the return on the investment in software is expected to be enormous. Otherwise there is too large a chance that overruns will change a project from profitable to unprofitable. Waterfall - [Book reviews](https://www.johndcook.com/blog/book_reviews/) - A list of books I reviewed for MAA online book reviews - [Amazon](https://www.johndcook.com/blog/amazon/) - Support this web site through Amazon commissions - [Computational math](https://www.johndcook.com/blog/applied-computation/) - Technical computation: numerical analysis, Kalman filters, signal processing, network analysis, statistical computing, ... - [Complex networks](https://www.johndcook.com/blog/complex-networks/) - Help understanding complex networks such as social graphs, customer interactions, sensor networks, etc. - [Details for predicting adult heights](https://www.johndcook.com/blog/height_details/) - Details of the math used to predict a child's adult height - [Quick start FAQ for C++ TR1 regular expressions](https://www.johndcook.com/blog/tr1regexquickstart/) - Notes on getting up and going quickly with regular expressions and C++ - [Formal determination](https://www.johndcook.com/blog/formal-determination/) - Help with formal determination by a professional statistician that data have been deidentified to the degree required by the HIPAA privacy rule. - [John Cook](https://www.johndcook.com/blog/about/) - Consultant in applied mathematics, Bayesian statistics, and scientific computing. Experience with PDEs, clinical trials, and mathematical modeling. - [Axioms for modal logics S1 through S5](https://www.johndcook.com/blog/lewis-modal-logics/) - You'll see references to modal logic systems S4 and S5, which raises the question what were S1, S2, and S3? We give the axioms for these systems here. - [Stand-alone Haskell code for inverse of standard normal CDF](https://www.johndcook.com/blog/haskell-inverse-normal-cdf/) - Stand-alone pure Haskell code to compute the inverse of the standard normal CDF (cumulative distribution function). - [Computing linear regression in one pass](https://www.johndcook.com/blog/running_regression/) - How to calculate linear regression coefficients in one pass through your data - [Privacy consulting: Anonymized data, statistical databases](https://www.johndcook.com/blog/applied-privacy/) - Removing obvious identifiers is NOT enough to insure that a database has been anonymized. Complying with regulations such as HIPAA or GDPR requires more. - [Database of musical scales](https://www.johndcook.com/blog/database-of-musical-scales/) - A list of all possible musical scales, for a particular definition of "all." - [Articulate mathematician and statistician](https://www.johndcook.com/blog/articulate-mathematician-statistician/) - When you need someone who is not only an expert in mathematics and statistics but who also can also communicate clearly. - [Filling in the gaps](https://www.johndcook.com/blog/applied-interpolation-and-extrapolation/) - You have data, but not where you want it. You want to fill in the gaps or make forecasts. You need interpolation, extrapolation, or maybe regression. - [Table of normal tail probabilities](https://www.johndcook.com/blog/table-of-normal-tail-probabilities/) - Table giving the probability of a sample from a normal random variable being more than k standard deviations from its mean for k = 1 to 100. - [Numerical Integration Consulting](https://www.johndcook.com/blog/numerical-integration/) - Experts in developing efficient algorithms and software for numerical evaluating integrals that arise in applied mathematics and statistics. - [](https://www.johndcook.com/blog/top/) - Consulting in applied mathematics, statistics, and scientific computing. Problems solved and results communicated clearly. - [Clients](https://www.johndcook.com/blog/clients-new/) - Hitachi Data Systems, Amgen, Google, Amazon, Facebook, Edward Tufte, Rice University, Advanced Micro Devices, Microsoft, Merck, U. S. Army Corps of Engineers, Androvia Life Sciences, ... - [Applied functional analysis](https://www.johndcook.com/blog/applied-functional-analysis/) - Functional analysis is central to applications such as differential equations, approximation theory, control theory, optimization, etc. - [Probability modeling](https://www.johndcook.com/blog/probability-modeling/) - Why probability models If you want a mathematical model to incorporate uncertainty, you create a probability model. Probability models uncertainty. An application of probability need not have anything to do with randomness; randomness is only one kind of uncertainty. If something is perfectly deterministic in theory but not accurately known, it's often useful to model it as - [Functional programming](https://www.johndcook.com/blog/applied-functional-programming/) - Need some help moving to functional programming? Unsure how far to go down the functional programming road? - [Staff Augmentation & Mentoring for Data Scientists](https://www.johndcook.com/blog/mentoring-for-data-scientists/) - Data science is young and so data scientists have gaps in their background. We can help you fill in these gaps through staff augmentation and through mentoring. - [Plots of all elementary cellular automata with random initial conditions](https://www.johndcook.com/blog/automata-plots/) - Plots of all 256 possible elementary cellular automata, with random initial conditions. - [Thank you](https://www.johndcook.com/blog/thank-you/) - Thank you for your email. I do my best to respond to email within one business day.You can also contact me by phone at (832) 422-8646. Other places you can find me: (832) 422-8646 info@johndcook.com @JohnDCook Blog LinkedIn Monthly newsletter vCard - [Windows sans mouse](https://www.johndcook.com/blog/windows_sans_mouse/) - Links to resources for learning to use Windows without a mouse - [Books](https://www.johndcook.com/blog/books_page/) - Books mentioned on my blog, with links to the posts where they appear - [Consulting](https://www.johndcook.com/blog/consulting/) - Analyzing data, combining expert opinion and data, creating mathematical models, interpreting results in a way that anyone can understand and act on. - [Agile Software Development Project Management Consultants](https://www.johndcook.com/blog/agile-software-development/) - You can't manage an agile software project the way you manage traditional software projects, otherwise your project will be agile in name only. - [Services](https://www.johndcook.com/blog/services/) - I help companies make better decisions by taking advantage of the data they have, combining it with expert opinion, creating mathematical models, overcoming computational difficulties, and interpreting the results. I work with clients ranging from solo entrepreneurs to some of the world’s largest software and biotech companies. Data analysis Bayesian analysis Complex networks Data science staff augmentation - [Business Forecasting and Management](https://www.johndcook.com/blog/business-forecasting-and-management/) - Mathematics is a way of seeing. It allows you to see patterns invisible to the naked eye, to cut through noise and find the signal underneath. Mathematics can give your business a way to quantify and substantially reduce your risk exposure, forecast future trends, and make more informed decisions. Mathematical models, when expertly constructed, guide decisions by capturing the essential aspects - [Testing C++ TR1 random number generation](https://www.johndcook.com/blog/test_tr1_random/) - How to test (your understanding of) random number generation in C++ - [Emacs kill (cut) commands](https://www.johndcook.com/blog/emacs_kill_commands/) - Notes on ways to kill (cut) text in Emacs. Character-oriented commands begin with control. Commands for semantic units start with Alt. - [Stand-alone Haskell code for standard normal CDF](https://www.johndcook.com/blog/haskell-phi/) - Stand-alone code for computing Phi(x), the cumulative density function of the standard normal distribution - [Stand-alone Haskell code for the error function](https://www.johndcook.com/blog/haskell-erf/) - Pure Haskell code with no dependencies for computing the error function erf(x). - [Relations between Bessel functions](https://www.johndcook.com/blog/bessel_functions/) - How the various kinds of Bessel functions relate to each other - [Most popular](https://www.johndcook.com/blog/most-popular/) - Most popular posts on my blog, The Endeavour - [Number crunching](https://www.johndcook.com/blog/number_crunching/) - Consulting in numerical computation - [PowerShell script to report catch blocks](https://www.johndcook.com/blog/catchblocks/) - PowerShell script to pull out and report catch blocks in C# and C++ code - [Integrate](https://www.johndcook.com/blog/integrate/) - Integration in the sense of bringing things together as well as integration in the mathematical sense - [Math diagrams](https://www.johndcook.com/blog/math_diagrams/) - Mathematical diagrams explaining special functions, probability distributions, modes of convergence, conjugate priors, category theory, general topology - [Error in the normal approximation to the t distribution](https://www.johndcook.com/blog/normal_approx_to_t/) - Notes on the error in approximating a Student t distribution by a normal distribution - [Emacs point (cursor) movement](https://www.johndcook.com/blog/emacs_move_cursor/) - Summary of the ways to move the point (cursor) in Emacs - [Drawing an icosahedron](https://www.johndcook.com/blog/draw_icosahedron/) - How to use Mathematica to draw an icosahedron - [Communicate](https://www.johndcook.com/blog/communicate/) - Good communication between technical staff and business leaders can make the difference between whether a project succeeds or fails. - [Clients](https://www.johndcook.com/blog/clients/) - Over the years I've worked with a wide variety of clients, some of which are represented below. You can read what some clients have had to say here. Please contact me if you'd like to discuss what I've done for clients and what I can do for you. - [C++](https://www.johndcook.com/blog/applied-c-plus-plus/) - Resources on this site for C++ programmers - [Analyze](https://www.johndcook.com/blog/analyze/) - Mathematical models let you answer questions that would be expensive or impossible to address directly. Take advantage of your data. - [What I believe](https://www.johndcook.com/blog/faith/) - My statement of faith: the Nicene creed ## Clients - [Google](https://www.johndcook.com/blog/clients/google/) - Exploratory network analysis of enormous data set - [Facebook](https://www.johndcook.com/blog/clients/facebook/) - Statistical analysis and data privacy consulting - [Navican Genomics](https://www.johndcook.com/blog/clients/rice/) - Served as member of the Scientific Advisory Board - [U.S. Army Corps of Engineers](https://www.johndcook.com/blog/clients/u-s-army-corps-of-engineers/) - Error estimation for finite element modeling for the US Army Corps of Engineers - [Androvia LifeSciences](https://www.johndcook.com/blog/clients/androvia-lifesciences/) - Predictive analysis of reproductive success - [Edward Tufte](https://www.johndcook.com/blog/clients/edward-tufte/) - Recommendations for literate programming software - [Amazon Prime Air](https://www.johndcook.com/blog/clients/amazon/) - Various applied math problems relating to drones - [Microsoft](https://www.johndcook.com/blog/clients/microsoft/) - Prepared case study for scientific computing in Python on Azure - [Advanced Micro Devices](https://www.johndcook.com/blog/clients/amd/) - Developed numerical algorithms for implementation in microcode - [Hitachi Data Systems](https://www.johndcook.com/blog/clients/hitachi/) - Cost / benefit analysis of various approaches to massive data storage - [Merck](https://www.johndcook.com/blog/clients/merck/) - Helped improve statistical software development procedures - [Amgen](https://www.johndcook.com/blog/clients/amgen/) - Mathematical modeling and statistical analysis ## Categories - [Uncategorized](https://www.johndcook.com/blog/category/uncategorized/) - [Business](https://www.johndcook.com/blog/category/business/) - [Clinical trials](https://www.johndcook.com/blog/category/clinical-trials/) - [Computing](https://www.johndcook.com/blog/category/computing/) - [Creativity](https://www.johndcook.com/blog/category/creativity/) - [Graphics](https://www.johndcook.com/blog/category/graphics/) - [Math](https://www.johndcook.com/blog/category/math/) - [Music](https://www.johndcook.com/blog/category/music/) - [PowerShell](https://www.johndcook.com/blog/category/powershell/) - [Python](https://www.johndcook.com/blog/category/python/) - [Science](https://www.johndcook.com/blog/category/science/) - [Software development](https://www.johndcook.com/blog/category/software-development/) - [Statistics](https://www.johndcook.com/blog/category/statistics/) - [Typography](https://www.johndcook.com/blog/category/typography/) - [Machine learning](https://www.johndcook.com/blog/category/machine-learning/) - [Geography](https://www.johndcook.com/blog/category/geography/) - [Algorithms](https://www.johndcook.com/blog/category/algorithms/) - [Productivity](https://www.johndcook.com/blog/category/productivity/) - [Parallel computing](https://www.johndcook.com/blog/category/parallel-computing/) - [Games](https://www.johndcook.com/blog/category/games/) - [AI](https://www.johndcook.com/blog/category/ai/) - [Artificial Intelligence](https://www.johndcook.com/blog/category/artificial-intelligence/) - [Data](https://www.johndcook.com/blog/category/data/) - [High Performance Computing](https://www.johndcook.com/blog/category/high-performance-computing/) - [Performance engineering](https://www.johndcook.com/blog/category/performance-engineering/) - [Computational Complexity](https://www.johndcook.com/blog/category/computational-complexity/) ## Tags - [Agile](https://www.johndcook.com/blog/tag/agile/) - [Apple](https://www.johndcook.com/blog/tag/apple/) - [Architecture](https://www.johndcook.com/blog/tag/architecture/) - [Audio](https://www.johndcook.com/blog/tag/audio/) - [Awk](https://www.johndcook.com/blog/tag/awk/) - [Bayesian](https://www.johndcook.com/blog/tag/bayesian/) - [Bias](https://www.johndcook.com/blog/tag/bias/) - [Biostatistics](https://www.johndcook.com/blog/tag/biostatistics/) - [Books](https://www.johndcook.com/blog/tag/books/) - [C++](https://www.johndcook.com/blog/tag/c/) - [Cancer](https://www.johndcook.com/blog/tag/cancer/) - [Chaos](https://www.johndcook.com/blog/tag/chaos/) - [Chess](https://www.johndcook.com/blog/tag/chess/) - [Clojure](https://www.johndcook.com/blog/tag/clojure/) - [Cloud computing](https://www.johndcook.com/blog/tag/cloud-computing/) - [CodeProject](https://www.johndcook.com/blog/tag/codeproject/) - [Coffee](https://www.johndcook.com/blog/tag/coffee/) - [Computer science](https://www.johndcook.com/blog/tag/computer-science/) - [Convergence](https://www.johndcook.com/blog/tag/convergence/) - [Convexity](https://www.johndcook.com/blog/tag/convexity/) - [Cryptography](https://www.johndcook.com/blog/tag/cryptography/) - [CSharp](https://www.johndcook.com/blog/tag/csharp/) - [CSS](https://www.johndcook.com/blog/tag/css/) - [Debugging](https://www.johndcook.com/blog/tag/debugging/) - [Differential equations](https://www.johndcook.com/blog/tag/differential-equations/) - [Differential geometry](https://www.johndcook.com/blog/tag/differential-geometry/) - [Economics](https://www.johndcook.com/blog/tag/economics/) - [Education](https://www.johndcook.com/blog/tag/education/) - [Emacs](https://www.johndcook.com/blog/tag/emacs/) - [Engineering](https://www.johndcook.com/blog/tag/engineering/) - [Entrepreneurship](https://www.johndcook.com/blog/tag/entrepreneurship/) - [Etymology](https://www.johndcook.com/blog/tag/etymology/) - [F#](https://www.johndcook.com/blog/tag/f/) - [Fibonacci](https://www.johndcook.com/blog/tag/fibonacci/) - [Functional programming](https://www.johndcook.com/blog/tag/functional-programming/) - [gcc](https://www.johndcook.com/blog/tag/gcc/) - [Genetics](https://www.johndcook.com/blog/tag/genetics/) - [Geodesy](https://www.johndcook.com/blog/tag/geodesy/) - [Golden ratio](https://www.johndcook.com/blog/tag/golden-ratio/) - [Grammar](https://www.johndcook.com/blog/tag/grammar/) - [History](https://www.johndcook.com/blog/tag/history/) - [HTML](https://www.johndcook.com/blog/tag/html/) - [Hurricane Ike](https://www.johndcook.com/blog/tag/hurricane-ike/) - [Illusion](https://www.johndcook.com/blog/tag/illusion/) - [Information theory](https://www.johndcook.com/blog/tag/information-theory/) - [Inkscape](https://www.johndcook.com/blog/tag/inkscape/) - [Innovation](https://www.johndcook.com/blog/tag/innovation/) - [Integration](https://www.johndcook.com/blog/tag/integration/) - [Interview](https://www.johndcook.com/blog/tag/interview/) - [iPod](https://www.johndcook.com/blog/tag/ipod/) - [IronPython](https://www.johndcook.com/blog/tag/ironpython/) - [Java](https://www.johndcook.com/blog/tag/java/) - [JavaScript](https://www.johndcook.com/blog/tag/javascript/) - [Julia](https://www.johndcook.com/blog/tag/julia/) - [Knuth](https://www.johndcook.com/blog/tag/knuth/) - [LaTeX](https://www.johndcook.com/blog/tag/latex/) - [Leadership](https://www.johndcook.com/blog/tag/leadership/) - [Linguistics](https://www.johndcook.com/blog/tag/linguistics/) - [Linux](https://www.johndcook.com/blog/tag/linux/) - [Literate programming](https://www.johndcook.com/blog/tag/literate-programming/) - [Machine translation](https://www.johndcook.com/blog/tag/machine-translation/) - [Macintosh](https://www.johndcook.com/blog/tag/macintosh/) - [Magic squares](https://www.johndcook.com/blog/tag/magic-squares/) - [Mathematica](https://www.johndcook.com/blog/tag/mathematica/) - [Microarrays](https://www.johndcook.com/blog/tag/microarrays/) - [Minimalism](https://www.johndcook.com/blog/tag/minimalism/) - [MS Office](https://www.johndcook.com/blog/tag/ms-office/) - [Neurogenesis](https://www.johndcook.com/blog/tag/neurogenesis/) - [Neuroplasticity](https://www.johndcook.com/blog/tag/neuroplasticity/) - [notation](https://www.johndcook.com/blog/tag/notation/) - [Number theory](https://www.johndcook.com/blog/tag/number-theory/) - [Optimization](https://www.johndcook.com/blog/tag/optimization/) - [Originality](https://www.johndcook.com/blog/tag/originality/) - [Overflow](https://www.johndcook.com/blog/tag/overflow/) - [PDF](https://www.johndcook.com/blog/tag/pdf/) - [Perl](https://www.johndcook.com/blog/tag/perl/) - [Physics](https://www.johndcook.com/blog/tag/physics/) - [Power laws](https://www.johndcook.com/blog/tag/power-laws/) - [Privacy](https://www.johndcook.com/blog/tag/privacy/) - [Prob](https://www.johndcook.com/blog/tag/prob/) - [Probability](https://www.johndcook.com/blog/tag/probability/) - [Probability and Statistics](https://www.johndcook.com/blog/tag/probability-and-statistics/) - [Productivity](https://www.johndcook.com/blog/tag/productivity/) - [Programming](https://www.johndcook.com/blog/tag/programming/) - [Proofs](https://www.johndcook.com/blog/tag/proofs/) - [Quality](https://www.johndcook.com/blog/tag/quality/) - [Quotes](https://www.johndcook.com/blog/tag/quotes/) - [R](https://www.johndcook.com/blog/tag/r/) - [Ramanujan](https://www.johndcook.com/blog/tag/ramanujan/) - [Regular expressions](https://www.johndcook.com/blog/tag/regular-expressions/) - [Reproducibility](https://www.johndcook.com/blog/tag/reproducibility/) - [RNG](https://www.johndcook.com/blog/tag/rng/) - [RSS](https://www.johndcook.com/blog/tag/rss/) - [Rstat](https://www.johndcook.com/blog/tag/rstat/) - [Rstats](https://www.johndcook.com/blog/tag/rstats/) - [Ruby](https://www.johndcook.com/blog/tag/ruby/) - [Scalability](https://www.johndcook.com/blog/tag/scalability/) - [SciPy](https://www.johndcook.com/blog/tag/scipy/) - [Security](https://www.johndcook.com/blog/tag/security/) - [Sed](https://www.johndcook.com/blog/tag/sed/) - [Simplicity](https://www.johndcook.com/blog/tag/simplicity/) - [Sitemap](https://www.johndcook.com/blog/tag/sitemap/) - [Special functions](https://www.johndcook.com/blog/tag/special-functions/) - [SQL](https://www.johndcook.com/blog/tag/sql/) - [Sweave](https://www.johndcook.com/blog/tag/sweave/) - [Twitter](https://www.johndcook.com/blog/tag/twitter/) - [UI](https://www.johndcook.com/blog/tag/ui/) - [Unicode](https://www.johndcook.com/blog/tag/unicode/) - [Unix](https://www.johndcook.com/blog/tag/unix/) - [Vista](https://www.johndcook.com/blog/tag/vista/) - [Windows](https://www.johndcook.com/blog/tag/windows/) - [Wine](https://www.johndcook.com/blog/tag/wine/) - [XML](https://www.johndcook.com/blog/tag/xml/) - [Modeling](https://www.johndcook.com/blog/tag/modeling/) - [SymPy](https://www.johndcook.com/blog/tag/sympy/) - [Lisp](https://www.johndcook.com/blog/tag/lisp/) - [Category theory](https://www.johndcook.com/blog/tag/category-theory/) - [Networks](https://www.johndcook.com/blog/tag/networks/) - [Machine learning](https://www.johndcook.com/blog/tag/machine-learning/) - [Functional analysis](https://www.johndcook.com/blog/tag/functional-analysis/) - [Haskell](https://www.johndcook.com/blog/tag/haskell/) - [Coq](https://www.johndcook.com/blog/tag/coq/) - [Logic](https://www.johndcook.com/blog/tag/logic/) - [Puzzles](https://www.johndcook.com/blog/tag/puzzles/) - [Topology](https://www.johndcook.com/blog/tag/topology/) - [Algebraic geometry](https://www.johndcook.com/blog/tag/algebraic-geometry/) - [Sage](https://www.johndcook.com/blog/tag/sage/) - [Computational statistics](https://www.johndcook.com/blog/tag/computational-statistics/) - [Random inequalities](https://www.johndcook.com/blog/tag/random-inequalities/) - [Decision theory](https://www.johndcook.com/blog/tag/decision-theory/) - [Business](https://www.johndcook.com/blog/tag/business/) - [Clinical trials](https://www.johndcook.com/blog/tag/clinical-trials/) - [Creativity](https://www.johndcook.com/blog/tag/creativity/) - [Graphics](https://www.johndcook.com/blog/tag/graphics/) - [Math](https://www.johndcook.com/blog/tag/math/) - [Music](https://www.johndcook.com/blog/tag/music/) - [PowerShell](https://www.johndcook.com/blog/tag/powershell/) - [Python](https://www.johndcook.com/blog/tag/python/) - [Science](https://www.johndcook.com/blog/tag/science/) - [Typography](https://www.johndcook.com/blog/tag/typography/) - [Graphs](https://www.johndcook.com/blog/tag/graphs/) - [MCMC](https://www.johndcook.com/blog/tag/mcmc/) - [Acoustics](https://www.johndcook.com/blog/tag/acoustics/) - [Continued fractions](https://www.johndcook.com/blog/tag/continued-fractions/) - [Fourier analysis](https://www.johndcook.com/blog/tag/fourier-analysis/) - [Signal processing](https://www.johndcook.com/blog/tag/signal-processing/) - [Complex analysis](https://www.johndcook.com/blog/tag/complex-analysis/) - [Genealogy](https://www.johndcook.com/blog/tag/genealogy/) - [Kalman filter](https://www.johndcook.com/blog/tag/kalman-filter/) - [Integral equations](https://www.johndcook.com/blog/tag/integral-equations/) - [Tensors](https://www.johndcook.com/blog/tag/tensors/) - [OSX](https://www.johndcook.com/blog/tag/osx/) - [Ring theory](https://www.johndcook.com/blog/tag/ring-theory/) - [Saxophone](https://www.johndcook.com/blog/tag/saxophone/) - [Ergodic theory](https://www.johndcook.com/blog/tag/ergodic-theory/) - [Interpolation](https://www.johndcook.com/blog/tag/interpolation/) - [Combinatorics](https://www.johndcook.com/blog/tag/combinatorics/) - [Linear algebra](https://www.johndcook.com/blog/tag/linear-algebra/) - [Probabi](https://www.johndcook.com/blog/tag/probabi/) - [Group theory](https://www.johndcook.com/blog/tag/group-theory/) - [Artificial intelligence](https://www.johndcook.com/blog/tag/artificial-intelligence/) - [Elliptic curves](https://www.johndcook.com/blog/tag/elliptic-curves/) - [Geo](https://www.johndcook.com/blog/tag/geo/) - [Coding theory](https://www.johndcook.com/blog/tag/coding-theory/) - [Queueing theory](https://www.johndcook.com/blog/tag/queueing-theory/) - [Quaternions](https://www.johndcook.com/blog/tag/quaternions/) - [Dynamical systems](https://www.johndcook.com/blog/tag/dynamical-systems/) - [Command line](https://www.johndcook.com/blog/tag/command-line/) - [Measure theory](https://www.johndcook.com/blog/tag/measure-theory/) - [Inequalities](https://www.johndcook.com/blog/tag/inequalities/) - [Orbital mechanics](https://www.johndcook.com/blog/tag/orbital-mechanics/) - [Cellular automata](https://www.johndcook.com/blog/tag/cellular-automata/) - [Partitions](https://www.johndcook.com/blog/tag/partitions/) - [Causality](https://www.johndcook.com/blog/tag/causality/) - [Radio](https://www.johndcook.com/blog/tag/radio/) - [Morse code](https://www.johndcook.com/blog/tag/morse-code/) - [Memory](https://www.johndcook.com/blog/tag/memory/) - [Design theory](https://www.johndcook.com/blog/tag/design-theory/) - [Phonetics](https://www.johndcook.com/blog/tag/phonetics/) - [Geometry](https://www.johndcook.com/blog/tag/geometry/) - [Neural networks](https://www.johndcook.com/blog/tag/neural-networks/) - [NLP](https://www.johndcook.com/blog/tag/nlp/) - [Numerical analysis](https://www.johndcook.com/blog/tag/numerical-analysis/) - [Numerica](https://www.johndcook.com/blog/tag/numerica/) - [Astronomy](https://www.johndcook.com/blog/tag/astronomy/) - [OSINT](https://www.johndcook.com/blog/tag/osint/) - [HPC](https://www.johndcook.com/blog/tag/hpc/) - [computer arithmetic](https://www.johndcook.com/blog/tag/computer-arithmetic/) - [scientific computing](https://www.johndcook.com/blog/tag/scientific-computing/) - [software correctness](https://www.johndcook.com/blog/tag/software-correctness/) - [multiprocessing](https://www.johndcook.com/blog/tag/multiprocessing/) - [multithreading](https://www.johndcook.com/blog/tag/multithreading/) - [parallel computing](https://www.johndcook.com/blog/tag/parallel-computing/) - [IDEs](https://www.johndcook.com/blog/tag/ides/) - [editors](https://www.johndcook.com/blog/tag/editors/) - [scientific research](https://www.johndcook.com/blog/tag/scientific-research/) - [digital notetaking](https://www.johndcook.com/blog/tag/digital-notetaking/) - [knowledge management](https://www.johndcook.com/blog/tag/knowledge-management/) - [scientific discovery](https://www.johndcook.com/blog/tag/scientific-discovery/) - [computer languages](https://www.johndcook.com/blog/tag/computer-languages/) - [software projects](https://www.johndcook.com/blog/tag/software-projects/) - [software planning](https://www.johndcook.com/blog/tag/software-planning/) - [SAT solvers](https://www.johndcook.com/blog/tag/sat-solvers/) - [SMT solvers](https://www.johndcook.com/blog/tag/smt-solvers/) - [NP-completeness](https://www.johndcook.com/blog/tag/np-completeness/) - [tractability](https://www.johndcook.com/blog/tag/tractability/) - [Mental math](https://www.johndcook.com/blog/tag/mental-math/) - [Humor](https://www.johndcook.com/blog/tag/humor/) - [Ai](https://www.johndcook.com/blog/tag/ai/) - [LLMs](https://www.johndcook.com/blog/tag/llms/) - [benchmarks](https://www.johndcook.com/blog/tag/benchmarks/) - [measurement](https://www.johndcook.com/blog/tag/measurement/) - [intelligence](https://www.johndcook.com/blog/tag/intelligence/) - [history of ideas](https://www.johndcook.com/blog/tag/history-of-ideas/) - [diffusion of ideas](https://www.johndcook.com/blog/tag/diffusion-of-ideas/) - [maverick science](https://www.johndcook.com/blog/tag/maverick-science/) - [Number systems](https://www.johndcook.com/blog/tag/number-systems/) - [DeepSeek](https://www.johndcook.com/blog/tag/deepseek/) - [OpenAI](https://www.johndcook.com/blog/tag/openai/) - [supercomputing](https://www.johndcook.com/blog/tag/supercomputing/) - [database optimization](https://www.johndcook.com/blog/tag/database-optimization/) - [performance engineering](https://www.johndcook.com/blog/tag/performance-engineering/) - [hyperscale](https://www.johndcook.com/blog/tag/hyperscale/) - [system benchmarks](https://www.johndcook.com/blog/tag/system-benchmarks/) - [Z3](https://www.johndcook.com/blog/tag/z3/) - [satisfiability](https://www.johndcook.com/blog/tag/satisfiability/) - [constraint solvers](https://www.johndcook.com/blog/tag/constraint-solvers/) - [data science](https://www.johndcook.com/blog/tag/data-science/) - [empirical methods](https://www.johndcook.com/blog/tag/empirical-methods/) - [large language models](https://www.johndcook.com/blog/tag/large-language-models/) - [explainable AI](https://www.johndcook.com/blog/tag/explainable-ai/) - [scientific publications](https://www.johndcook.com/blog/tag/scientific-publications/) - [Cryptocurrency](https://www.johndcook.com/blog/tag/cryptocurrency/) - [Nvidia](https://www.johndcook.com/blog/tag/nvidia/) - [parallel software](https://www.johndcook.com/blog/tag/parallel-software/) - [Theory of interest](https://www.johndcook.com/blog/tag/theory-of-interest/) - [Automated reasoning](https://www.johndcook.com/blog/tag/automated-reasoning/) - [CUDA](https://www.johndcook.com/blog/tag/cuda/) - [kernels](https://www.johndcook.com/blog/tag/kernels/) - [GPU](https://www.johndcook.com/blog/tag/gpu/) - [AMD](https://www.johndcook.com/blog/tag/amd/) - [ROCm](https://www.johndcook.com/blog/tag/rocm/) - [vocabulary learning](https://www.johndcook.com/blog/tag/vocabulary-learning/) - [textual analysis](https://www.johndcook.com/blog/tag/textual-analysis/) - [language learning](https://www.johndcook.com/blog/tag/language-learning/) - [Calendars](https://www.johndcook.com/blog/tag/calendars/) - [algebra](https://www.johndcook.com/blog/tag/algebra/) - [quadratic equation](https://www.johndcook.com/blog/tag/quadratic-equation/) - [inverse problem](https://www.johndcook.com/blog/tag/inverse-problem/) - [AI Scientist Systems](https://www.johndcook.com/blog/tag/ai-scientist-systems/) - [GPT-5](https://www.johndcook.com/blog/tag/gpt-5/) - [coding agents](https://www.johndcook.com/blog/tag/coding-agents/) - [Navigation](https://www.johndcook.com/blog/tag/navigation/) - [Compression](https://www.johndcook.com/blog/tag/compression/) - [ZKP](https://www.johndcook.com/blog/tag/zkp/) - [AI reliability](https://www.johndcook.com/blog/tag/ai-reliability/) - [AI hallucinations](https://www.johndcook.com/blog/tag/ai-hallucinations/) - [Reproducibility crisis](https://www.johndcook.com/blog/tag/reproducibility-crisis/) - [Prompt engineering](https://www.johndcook.com/blog/tag/prompt-engineering/) - [AI chatbots](https://www.johndcook.com/blog/tag/ai-chatbots/) - [Nondeterministic algorithms](https://www.johndcook.com/blog/tag/nondeterministic-algorithms/) - [Usability](https://www.johndcook.com/blog/tag/usability/)