atlas news
    
John D. Cook
13  novembre     15h25
Four generalizations of the Pythagorean theorem
John    Here are four theorems that generalize the Pythagorean theorem. Follow the links for more details regarding each equation. 1. Theorem by Apollonius for general triangles. 2. Edsgar Dijkstra’s extension of the Pythagorean theorem for general triangles. 3. A generalization of the Pythagorean theorem...
12  novembre     14h55
Elementary symmetric polynomials and optimization
John    The mth elementary symmetric polynomial of degree n is the sum of all terms containing a product of m variables. So, for example, These polynomials came up in the previous post. The problem was choosing weights to minimize the variance of a weighted sum of random variables can be solved using...
    13h02
Weighting an average to minimize variance
John    Suppose you have 100 to invest in two independent assets, A and B, and you want to minimize volatility. Suppose A is more volatile than B. Then putting all your money on A would be the worst thing to do, but putting all your money on B would not be the best thing to do. The optimal allocation would...
10  novembre     19h14
Brownian motion and Riemann zeta
John    Excellent video by Almost Sure: What does Riemann Zeta have to do with Brownian Motion? Connects several things that I’ve written about here including Brownian motion, the Riemann zeta function, and the Kolmogorov-Smirnov test. The post Brownian motion and Riemann zeta first appeared on John D....
09  novembre     18h54
Rolling correlation
John    Suppose you have data on the closing prices of two stocks over 1,000 days and you want to look at the correlation between the two asset prices over time in rolling 30 day windows. It seems that the rolling correlation is periodic. peaking about every 50 days. But this is an artifact of the rolling ...
    01h47
Analog of Heron’s formula on a sphere
John    The area of a triangle can be computed directly from the lengths of its sides via Heron’s formula. Here s is the semiperimeter, s (a b c) 2. Is there an analogous formula for spherical triangles? It’s not obvious there should be, but there is a formula by Simon Antoine Jean L’Huilier (1750-1840)....
07  novembre     14h01
How much is a gigawatt?
John    There’s increasing talk of gigawatt data centers. Currently the largest data center, Switch’s Citadel Campus in Nevada, uses 850 megawatts of power. OpenAI’s Stargate data center, under construction, is supposed to use 1.2 gigawatts. Gigawatt An average French nuclear reactor produces about a...
05  novembre     11h45
Japanese polygon theorem
John    Here’s an interesting theorem that leads to some aesthetically pleasing images. It’s known as the Japanese cyclic polygon theorem. For all triangulations of a cyclic polygon, the sum of inradii of the triangles is constant. Conversely, if the sum of inradii is independent of the triangulation, then...
03  novembre     16h12
Tetrahedral analog of the Pythagorean theorem
John    A tetrahedron has four triangular faces. Suppose three of those faces come together like the corner of a cube, each perpendicular to the other. Let A1, A2, and A3 be the areas of the three triangles that meet at this corner and let A0 be the area of remaining face, the one opposite the right [&]...
02  novembre     22h12
The anti-Smith chart
John    As I’ve written about several times lately, the Smith chart is the image of a rectangular grid in the right half-plane under the function f(z) (z’ 1) (z 1). What would the image of a grid in the left half-plane look like? For starters, since f maps the right half-plane to the interior of the unit ...
    13h10
Impedance and Triangular Numbers
John    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...
01  novembre     14h28
Cross ratio
John    The cross ratio of four points A, B, C, D is defined by where XY denotes the length of the line segment from X to Y. The idea of a cross ratio goes back at least as far as Pappus of Alexandria (c. 290 - c. 350 AD). Numerous theorems from geometry are stated in terms of the cross ratio. For example,...
31  octobre     15h44
Text case changes the size of QR codes
John    Let’s make a QR code out of a sentence two ways: mixed case and upper case. We’ll use Python with the qrcode library. import qrcode s The quick brown fox jumps over the lazy dog. qrcode.make(s).save( mixed.png ) qrcode.make(s.upper()).save( upper.png ) Here are the mixed case and upper case QR...
30  octobre     13h02
An ancient generalization of the Pythagorean theorem
John    Apollonius of Perga (c. 262 BC - c. 190 BC) discovered a theorem that generalizes the Pythagorean theorem but isn’t nearly as well known. Let ABC be a general triangle, and let D be the midpoint of the segment AB. Let a be the length of the side opposite A and b the length of the side [&] The post...
29  octobre     14h24
Mentally compute logs base 2
John    The previous post required computing After writing the post, I thought about how you would mentally approximate log2 5. The most crude approximation would round 5 down to 4 and use log2 4 2 to approximate log2 5. That would be good enough for an order of magnitude guess, but we can do much better ...
    11h50
Physical Keys and Encryption Keys
John    A physical key, such as a house key, is a piece of metal with cuts of differing depths. Typically there may be around 6 cuts, with five different possible depths for each cut. This allows 56 15,625 possible keys. Encryption keys, such as AES keys, are a string of bits, often 128 bits, for [&] The...
28  octobre     15h21
Freshman’s dream
John    The Freshman’s dream is the statement (x y)p xp yp It’s not true in general, but it is true mod p if p is a prime. It’s a cute result, but it’s also useful in applications, such as finite field computations in cryptography. Here’s a demonstration of the Freshman’s dream in Python. p [&] The post...
    14h00
Why and how Bitcoin uses Merkle trees
John    Yesterday’s post looked at a recently mined Bitcoin block, the 920,994th block in the blockchain, and verified that it contains the hash of the previous block. This post will look at the same block and verify its Merkle tree root. Before getting down to the bytes, we’ll back up and say what a...
27  octobre     15h54
How blocks are chained in a blockchain
John    The high-level explanation of a blockchain says that each block contains a cryptographic hash of the previous block. That’s how the blocks are chained together. That’s not exactly true, and it leaves out a lot of detail. This post will look in full detail at how Bitcoin blocks are chained together...
26  octobre     13h23
987654321 123456789
John    I recently saw someone post [1] that 987654321 123456789 is very nearly 8, specifically 8.0000000729. I wondered whether there’s anything distinct about base 10 in this. For example, would the ratio of 54321six and 12345six be close to an integer? The ratio is 4.00268, which is pretty close to 4....
25  octobre     14h47
Spacing the circles on the Smith chart
John    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 [&] The post Spacing...
23  octobre     14h16
How to make a Smith chart
John    The Smith chart from electrical engineering is the image of a Cartesian grid under the function f(z) (z’ 1) (z 1). More specifically, it’s the image of a grid in the right half-plane. This post will derive the basic mathematical properties of this graph but will not go into the applications. Said...
22  octobre     12h08
Generating random points in Colorado
John    The previous post looked at how to generate random points on a sphere, generating spherical coordinates directly. I wanted to include a demonstration that this generates points with the same distribution as the more customary way of generating points on a sphere, and then decided the demonstration...
    12h06
Random spherical coordinates
John    The topic of generating random points on a unit sphere has come up several times here. The standard method using normal random samples generates points (x, y, z) in Cartesian coordinates. If you wanted points in spherical coordinates, you could first generate points in Cartesian coordinates, then...
20  octobre     12h12
Distribution of correlation
John    One of the more subtle ideas to convey in an introductory statistics class is that statistics have distributions. Students implicitly think that when you calculate a statistic on a data set, say the mean, that then you have THE mean. But if your data are (modeled as) samples from a random variable,...
19  octobre     01h24
Distribution of coordinates on a sphere
John    Almost Sure posted an interesting fact on X: If a point (x, y, z) is chosen at random uniformly on the unit sphere, then x, y, and z each have the uniform distribution on [â ’1, 1] and zero correlations (but not independent ) This follows from Archimedes’ On the Sphere and Cylinder published in...
18  octobre     22h40
ODE to Fisher’s transform
John    I was calculating a correlation coefficient this afternoon and ran into something interesting. Suppose you have two uncorrelated random variables X and Y. If you draw, say, a thousand samples each from X and Y and compute Pearson’s correlation coefficient, you almost certainly will not get 0,...
    18h41
Quality metrics
John    Sometimes you’ll hear that a process has so many nines of reliability or that the error rate is so many sigmas. A few years ago I wrote a post on converting between nines and sigmas. See that post for details, approximations, etc. Here I’d like to post a new graph that I believe is an [&] The post...
17  octobre     11h58
Turning trig identities into Fibonacci identities
John    In 2013, John Conway and Alex Ryba published a brief note [1] on how to convert identities involving sine and cosine into identities involving Fibonacci and Lucas numbers. Fibonacci and Lucas The Fibonacci numbers Fn are defined by F0 0, F1 1, and Fn 2 Fn Fn 1 for n 1. Similarly, [&] The post...
16  octobre     18h47
Experiences with GPT-5-Codex
Wayne Joubert    OpenAI Codex is now generally available (see here, here). I’m using the Codex extension in the Cursor code editor with my OpenAI account. Codex is very helpful for some tasks, such as complex code refactoring, implementing skeleton code for an operation, or writing a single small self-contained...