The slang “tl;dr” stands for “too long; didn’t read.” The context is often either a bad joke or a shallow understanding.

What bothers me most about tl;dr is the mindset it implies, scanning everything but reading nothing. I find myself slipping into that mode sometimes. Skimming is a vital skill, but it can become so habitual that it crowds out reflective reading.

When I realize everything I’m reading is short and new, when my patience has atrophied to the point that I get annoyed at long tweets, I’ll read something long and old to restore my concentration and perspective.

Related posts:

How Emacs influenced Ruby

Ruby creator Yukihiro Matsumoto gave a presentation How Emacs changed my Life in which he explains how Emacs influenced him personally and how it influenced the programming language he created. Here is his summary:

  1. Emacs taught me freedom for software.
  2. Emacs taught me how to code.
  3. Emacs taught me the power of Lisp.
  4. Emacs taught me how to implement a core language.
  5. Emacs taught me how to implement a garbage collector.
  6. Emacs helped me to code and debug.
  7. Emacs helped me to write and edit text/mails/documents.
  8. Emacs helped me to be an effective programmer.
  9. Emacs made me a hacker.
  10. Emacs has changed my life.

Numerous studies have confirmed …

I was listening to a business book in my car this afternoon. A couple times it said

Numerous studies have confirmed …

and I couldn’t help but hear

Several of my peers, who share my prejudices, were also able to do a multivariate regression and select a few variables out of hundreds to confirm the prevailing wisdom.

Maybe the prevailing wisdom is right. It often is. However, I’m not very impressed by attempts to shore up prevailing wisdom with linear regression, especially in business studies.

Related posts:

Polynomial determined by two inputs

Suppose p(x) is a polynomial with integer coefficients. If all the coefficients are non-negative, I can tell you what p(x) is if you’ll tell me the value of p(x) at just two points.

This sounds too good to be true. Don’t you need n+1 points to determine an nth degree polynomial? Not in this case. The trick is that first I ask for p(1). Call your answer q. Next I ask you for the value of p(q). That’s enough information to find all the coefficients.

I ran across this in the answer to a question on Math Overflow. Aeryk said

If you know that the coefficients are non-negative and also integral, then the polynomial can be completely determined by the values of p(1) and p(p(1)).

I suppose this is a well-known theorem, but I’d never seen it before.

ARupinksi added this explanation.

q=p(1) gives the sum of the coefficients. Now think of p(p(1))=p(q) written in base q; one sees that the “digits” are exactly the coefficients of p. The only possible ambiguity comes if p(q)=q^n for some n, but since the coefficients sum to q, one sees that p=qx^n−1 in this case.

This explanation is correct, but terse, so I’ll expand on it a bit. First a couple examples.

Suppose you tell me that p(1) = 9 and p(9) = 1497. I need to write 1497 in base 9. A little work shows 1497 = 2 × 93 + 4 ×9 + 3. This means me p(x) = 2 x3 + 4 x + 3.

Next suppose you tell me p(1) = 5 and p(5) = 625. Since 625 = 54, p(x) = 5 x3.

Here’s a slightly more formal, algorithmic explanation. Suppose

p(x) = a0 + a1x + a2x2 + … anxn.

We can recover the coefficients of p(x) from highest to lowest by repeatedly pulling out the largest powers of q we can. First we find the largest power of q less than p(x), say

qm < p(q) ≤ qm+1.

Then the quotient when p(q) is divided by qm is the coefficient am. If p(q) = qm+1, then am = q and we’re done. Otherwise,

p(q) = am qm + r

where 0 < r < qm. We repeat our process, pulling out the highest power of q out of r that we can to find the next coefficient. Since the coefficients sum to q, and we first found am ≥ 1, all our subsequent coefficients must be less than q.

Numerical integration trick

Suppose you want to evaluate the following integral:

int_{30}^infty \exp\left( -frac{100}{x+6} \right) , frac{1}{x^3} , \dx

We’d like to do a change of variables to make the range of integration finite, and we’d like the transformed integral to be easy to evaluate numerically.

The change of variables t = 1/x2 transforms the range of integration from (30, ∞) to (0, 1/900). I’ll explain where this choice came from and why it results in a nice function to integrate.

The integrand is essentially 1/x3 for large x because the exponential term approaches 1. If the integrand were exactly 1/x3 then the change of variables t = 1/x2 would make the integrand constant. So we’d expect this change of variables to give us an integrand that behaves well. In particular, the integral should be bounded at 0.

(If you’re not careful, a change of variables may just swap one kind of improper integral for another. That is, you can make the domain of integration finite, but at the cost of introducing a singularity in the transformed integrand. However, we don’t have that problem here because our change of variables was just right.)

In general, if you need to integrate a function that behaves like 1/xn as x goes to infinity, try the change of variables t = 1/xn-1.

Related post: The care and treatment of singularities

Math is like the Hawaiian islands

Keith Kendig compares math to the Hawaiian islands:

Hawaii may look like a group of separate islands, but actually the islands are just the highest peaks of an immense, mostly-submerged mountain range. All that water hides their underlying connectedness, their oneness. Mathematics may similarly seem like an archipelago of different areas — geometry, analysis, topology, number theory, applied math, and so on. My philosophy is that we’re really just seeing a few peaks of a huge mathematical mountain range. Our ignorance is like the water surrounding Hawaii and hiding its true mountain-rangeness. In mathematics, when we remove ignorance by making discoveries and advances, the water level in effect goes down, and when it drops far enough, separate islands are connected.

Source: Conics

Similar post: College math in a single symbol

SciPy integration misunderstanding

Today I needed to compute an integral similar to this:

int_{1000}^infty frac{dx}{100, x^3}

I used the following SciPy code to compute the integral:

from scipy.integrate import quad

def f(x):
    return 0.01*x**-3

integral, error = quad(f, 1000, sp.inf, epsrel = 1e-6)
print integral, error

My intention was to compute the integral to 6 significant figures. (epsrel is a shortened form of epsilon relative, i.e. relative error.) To my surprise, the estimated error was larger than the value of the integral. Specifically, the integral was computed as 5.15 × 10-9 and the error estimate was 9.07 × 10-9.

What went wrong? The integration routine quad lets you specify either a desired bound on your absolute error (epsabs) or a desired bound on your relative error (epsrel). I assumed that since I specified the relative error, the integration would stop when the relative error requirement was met. But that’s not how it works.

The quad function has default values for both epsabs and epsrel.

def quad(... epsabs=1.49e-8, epsrel=1.49e-8, ...):

I thought that since I did not specify an absolute error bound, the bound was not effective, or equivalently, that the absolute error target was 0. But no! It was as if I’d set the absolute error bound to 1.49 × 10-8. Because my integral is small (the exact value is 5 × 10-9) the absolute error requirement is satisfied before the relative error requirement and so the integration stops too soon.

The solution is to specify an absolute error target of zero. This condition cannot be satisfied, and so the relative error target will determine when the integration stops.

integral, error = quad(f, 1000, sp.inf, epsrel = 1e-6, epsabs = 0)

This correctly computes the integral as 5 × 10-9 and estimates the integration error as 4 ×10-18.

It makes some sense for quad to specify non-zero default values for both absolute and relative error, though I imagine most users expect small relative error rather than small absolute error, so perhaps the latter could be set to 0 by default.

Nicolas Bourbaki's wedding invitation

Nicolas Bourbaki was the collective pseudonym of a semi-secret group of French mathematicians, best known for the formal style of mathematics it promoted. The group insisted that Bourbaki was a real person, but only as a joke.

The most recent Math Mutation podcast quotes a wedding invitation for Bourbaki.

Monsieur Nicolas Bourbaki, Canonical Member of the Royal Academy of Poldavia, Grand Master of the Order of Compacts, Conserver of Uniforms, Lord Protector of Filters, and Madame née One-to-One, have the honor of announcing the marriage of their daughter Betti …

The trivial isomorphism will be given to them by P. Adic, of the Diophantine Order, at the Principal Cohomology of the Universal Variety …

The organ will be played by Monsieur Modulo, Assistant Simplex of the Grassmannian (Lemmas will be sung by Scholia Cartanorum). …

After the congruence, Monsieur and Madame Bourbaki will receive guests in their Fundamental Domain …

The original French text and full English translation are available here.

The invitation is littered with obscure references to math in general but particularly references to Bourbaki-style math. For example, “Madame née One-to-One” is an allusion to Bourbaki’s attempt to replace the traditional term “one-to-one” with their coinage “injective.” The bride’s name alludes to Betti numbers, a kind of topological invariant. Etc.

The wedding invitation nearly cost Bourbaki member André Weil his life. Weil fled to Finland at the start of World War II. Finnish police found the wedding invitation and thought that it was an encoded message. Weil was sentenced to death as a spy but received a last-minute pardon.

Easiest and hardest classes to teach

I’ve taught a variety of math classes, and statistics has been the hardest to teach. The thing I find most challenging is coming up with homework problems. Most exercises are either blatantly artificial or extremely tedious. It’s hard to find moderately realistic problems that don’t take too long to work out.

The course I’ve found easiest to teach has been differential equations. The course has a flat structure: there’s a list of techniques to cover, all roughly the same level of difficulty. There are no deep analytic or philosophical issues to skirt around as there are in statistics. And it’s not hard to come up with practical applications that can be worked out fairly easily.

Related post: Impure math

Software to slice bread

In the dark ages of programming, functions acted on data. To slice your bread, you passed a bread data structure to a slice function:


Then came object oriented programming. Instead of having an external function slice our bread, we would ask the bread to slice itself by calling the slice method on a bread object:


Obviously a vast improvement.

Now object oriented programming has become more refined. First we create a bread-slicing object and then we simply pass bread objects to the slice method on the bread-slicer:

BreadSlicer slicer = new BreadSlicer();

sliced bread
Related posts:

Digital desk, analog desk

Austin Kleon has an interesting idea for setting up a workspace: have a digital desk and an analog desk.

I have two desks in my office — one is “analog” and one is “digital.” The analog desk has nothing but markers, pens, pencils, paper, index cards, and newspaper. Nothing electronic is allowed on that desk. That’s where most of my work is born … The digital desk has my laptop, my monitor, my scanner, and my drawing tablet. This is where I edit and publish my work.

From Steal Like an Artist.

The context of this quote is a discussion of how we think differently depending on the tools we use. I wrote something along these lines a while back: Create offline, analyze online.

Misplaced decimal

This evening I ran across a dialog that suggests that decimal notation is wrong.

It happened when I started learning about decimals in school. I knew then that ten has one zero, a hundred has two, a thousand three, and so on. And then this teacher starts saying that tenth doesn’t have any zero, a hundredth has only one, a thousandth has only two, and so on. … Only much later did I have enough perspective to put my finger on the problem: The decimal point is always misplaced!

Source: Conics. Emphasis in the original.

The proposed solution is to put the decimal point above the units position rather than after it. Then the notation would be symmetric. For example, 1000 and 1/1000 would look like this:

Of course decimal notation isn’t likely to change, but the author makes an interesting point.

iPad as hip flask

I reread Paul Graham’s essay The Acceleration of Addictiveness after a friend quoted it in a blog post explaining why he is taking an indefinite hiatus from social media. I hadn’t noticed this gem in the footnotes when I first read Graham’s essay:

Several people have told me they like the iPad because it lets them bring the Internet into situations where a laptop would be too conspicuous. In other words, it’s a hip flask.

Related post: How to neutralize intelligence