John D. Cook

https://www.johndcook.com/blog

226 posts · 22 Votes · 1 Followers

Science 51% · Tech 38% · Writing 5% · Culture 3% · Life 1% · Art 0% · 2 more 2%

Subscribe via RSS

  1. Artemis II, Apollo 8, and Apollo 13

    The Artemis II mission launched yesterday. Much like the Apollo 8 mission in 1968, the goal is to go around the moon in preparation for a future mission that will land on the moon. And like Apollo 13, the mission will swing around the moon rather than entering lunar orbit. Artemis II will deliberately follow […] The post Artemis II, Apollo 8, and Apollo 13 first appeared on John D. Cook.

    0 ▲
  2. Pentagonal numbers are truncated triangular numbers

    Pentagonal numbers are truncated triangular numbers. You can take the diagram that illustrates the nth pentagonal number and warp it into the base of the image that illustrates the (2n − 1)st triangular number. If you added a diagram for the (n − 1)st triangular number to the bottom of the image on the right, you’d […] The post Pentagonal numbers are truncated triangular numbers first appeared on John D. Cook.

    0 ▲
  3. Quantum Y2K

    I’m skeptical that quantum computing will become practical in the next 100 years. However, if it does become practical and we don’t prepare, the world’s financial system could collapse. Everyone agrees we should prepare for quantum computing, even those of us who doubt it will be practical any time soon. Quantum computers exist now, but […] The post Quantum Y2K first appeared on John D. Cook.

    0 ▲
  4. Morse code tree

    Peter Vogel posted the following image on X yesterday. The receive side of the coin is a decision tree for decoding Morse code. The shape is what makes this one interesting. Decision trees are typically not very compact. Each branch is usually on its own horizontal level, with diagonal lines going down from each node […] The post Morse code tree first appeared on John D. Cook.

    0 ▲
  5. An AI Odyssey, Part 3: Lost Needle in the Haystack

    While shopping on a major e-commerce site, I wanted to get an answer to an obscure question about a certain product. Not finding the answer immediately on the product page, I thought I’d try clicking the AI shopping assistant helper tool to ask this question. I waited with anticipation for an answer I would expect […] The post An AI Odyssey, Part 3: Lost Needle in the Haystack first appeared on John D. Cook.

    0 ▲
  6. Computing sine and cosine of complex arguments with only real functions

    Suppose you have a calculator or math library that only handles real arguments but you need to evaluate sin(3 + 4i). What do you do? If you’re using Python, for example, and you don’t have NumPy installed, you can use the built-in math library, but it will not accept complex inputs. >>> import math >>> […] The post Computing sine and cosine of complex arguments with only real functions first appeared on John D. Cook.

    0 ▲
  7. Lebesgue constants

    I alluded to Lebesgue constants in the previous post without giving them a name. There I said that the bound on order n interpolation error has the form where h is the spacing between interpolation points and δ is the error in the tabulated values. The constant c depends on the function f being interpolated, and to a […] The post Lebesgue constants first appeared on John D. Cook.

    0 ▲
  8. How much precision can you squeeze out of a table?

    Richard Feynman said that almost everything becomes interesting if you look into it deeply enough. Looking up numbers in a table is certainly not interesting, but it becomes more interesting when you dig into how well you can fill in the gaps. If you want to know the value of a tabulated function between values […] The post How much precision can you squeeze out of a table? first appeared on John D. Cook.

    0 ▲
  9. From Mendeleev to Fourier

    The previous post looked at an inequality discovered by Dmitri Mendeleev and generalized by Andrey Markov: Theorem (Markov): If P(x) is a real polynomial of degree n, and |P(x)| ≤ 1 on [−1, 1] then |P′(x)| ≤ n² on [−1, 1]. If P(x) is a trigonometric polynomial then Bernstein proved that the bound decreases from n² to n. Theorem […] The post From Mendeleev to Fourier first appeared on John D. Cook.

    0 ▲
  10. Mendeleev’s inequality

    Dmitri Mendeleev is best known for creating the first periodic table of chemical elements. He also discovered an interesting mathematical theorem. Empirical research led him to a question about interpolation, which in turn led him to a theorem about polynomials and their derivatives. I ran across Mendeleev’s theorem via a paper by Boas [1]. The […] The post Mendeleev’s inequality first appeared on John D. Cook.

    0 ▲
  11. Set intersection and difference at the command line

    A few years ago I wrote about comm, a utility that lets you do set theory at the command line. It’s a really useful little program, but it has two drawbacks: the syntax is hard to remember, and the input files must be sorted. If A and B are two sorted lists, comm A B […] The post Set intersection and difference at the command line first appeared on John D. Cook.

    0 ▲
  12. Embedded regex flags

    The hardest part of using regular expressions is not crafting regular expressions per se. In my opinion, the two hardest parts are minor syntax variations between implementations, and all the environmental stuff outside of regular expressions per se. Embedded regular expression modifiers address one of the environmental complications by putting the modifier in the regular expression […] The post Embedded regex flags first appeared on John D. Cook.

    0 ▲
  13. A lesser-known characterization of the gamma function

    The gamma function Γ(z) extends the factorial function from integers to complex numbers. (Technically, Γ(z + 1) extends factorial.) There are other ways to extend the factorial function, so what makes the gamma function the right choice? The most common answer is the Bohr-Mollerup theorem. This theorem says that if f: (0, ∞) → (0, […] The post A lesser-known characterization of the gamma function first appeared on John D. Cook.

    0 ▲
  14. Tighter bounds on alternating series remainder

    The alternating series test is part of the standard calculus curriculum. It says that if you truncate an alternating series, the remainder is bounded by the first term that was left out. This fact goes by in a blur for most students, but it becomes useful later if you need to do numerical computing. To […] The post Tighter bounds on alternating series remainder first appeared on John D. Cook.

    0 ▲
  15. Powers don’t clear fractions

    If a number has a finite but nonzero fractional part, so do all its powers. I recently ran across a proof in [1] that is shorter than I expected. Theorem: Suppose r is a real number that is not an integer, and the decimal part of r terminates. Then rk is not an integer for any positive integer […] The post Powers don’t clear fractions first appeared on John D. Cook.

    0 ▲
  16. Tone row operations

    The previous post introduced the idea of a twelve-tone row, a permutation of the twelve pitch classes of a chromatic scale. The earlier post also introduced a group of operations on a tone row with elements P, R, I, and RI. Here P, which stands for “prime”, is the identity operator: it leaves the tone […] The post Tone row operations first appeared on John D. Cook.

    0 ▲