John D. Cook Consulting Blog
8,886 FOLLOWERS
The Endeavor gives readers a sense of how they might combine their programming skills with business, and/or use those skills to solve real-world problems. It is the popular computer science-themed blog of John Cook, a former math professor and programmer who has transitioned into consulting. He helps companies make better decisions by taking advantage of the data they have, combining it with..
John D. Cook Consulting Blog
1w ago
Given a hash value, an you determine what algorithm produced it? Or what algorithm probably produced it? Obviously if a hash value is 128 bits long, then a 128-bit algorithm produced it. Such a hash value might have been produced by MD5, but not by SHA-1, because the former produces 128-bit hashes and the latter […]
The post Identifying hash algorithms first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
1w ago
Random number generators are subtle. Unless the generator is some physical device, random number generators (RNGs) are usually technically pseudorandom number generators (PRNGs), deterministic algorithms designed to mimic randomness. Suppose you have a PRNG that produces the digits 0 through 9. How might you test the output to see whether it (acts like it) is […]
The post Testing random number generators first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
1w ago
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 […]
The post Limitations on Venn diagrams first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
1w ago
I was just talking to a colleague about edit distance because it came up in a project we’re working on. Technically, we were discussing Levenshtein distance. It sounds more impressive to say Levenshtein distance, but it’s basically how much editing effort it would take to turn one block of text into another. Edit distance is […]
The post Edit distance first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
1w ago
The birthday problem is a party trick with serious practical applications. It’s well known to people who have studied probability, but the general public is often amazed by it. If you have a group of 23 people, there’s a 50-50 chance that at least two people have the same birthday. With a larger group, say […]
The post Birthday problem approximation first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
1w ago
“I keep running into the function f(z) = (1 − z)/(1 + z).” I wrote this three years ago and it’s still true. This function came up implicitly in the previous post. Ramanujan’s excellent approximation for the perimeter of an ellipse with semi-axes a and b begins by introducing λ = (a − b)/(a + […]
The post (1 − z) / (1 + z) first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
2w ago
Ramanujan discovered an incredibly accurate approximation for the perimeter of an ellipse. This post will illustrate how accurate the approximation is and push its limits. As with all computations involving ellipses, the accuracy of Ramanujan’s approximation increases as eccentricity increases. But the error increases slowly, and in fact is bounded. Let a and b be […]
The post Error in Ramanujan’s approximation for ellipse perimeter first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
2w ago
Someone with no exposure to probability or statistics likely has an intuitive sense that averaging random variables reduces variance, though they wouldn’t state it in those terms. They might, for example, agree that the average of several test grades gives a better assessment of a student than a single test grade. But data from a […]
The post The Cauchy distribution’s counter-intuitive behavior first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
3w ago
I recently ran across a theorem connecting the arithmetic mean, geometric mean, harmonic mean, and the golden ratio. Each of these comes fairly often, and there are elegant connections between them, but I don’t recall seeing all four together in one theorem before. Here’s the theorem [1]: The arithmetic, geometric, and harmonic means of two […]
The post Arithmetic, Geometry, Harmony, and Gold first appeared on John D. Cook ..read more
John D. Cook Consulting Blog
3w ago
I keep running into Edward John Routh (1831–1907). He is best known for the Routh-Hurwitz stability criterion but he pops up occasionally elsewhere. The previous post discussed Routh’s mnemonic for moments of inertia and his “stretch” theorem. This post will discuss his triangle theorem. Before stating Routh’s theorem, we need to say what a cevian […]
The post Ceva, cevians, and Routh’s theorem first appeared on John D. Cook ..read more