Posts tagged with obfuscation

A perlmonk asked for a “custom random number generator”. This is a non-maths person’s word for a probability distribution.

image

It was a slightly unusual case, but not hard. After I’d finished several easy steps, though, the final formula looked like it had been scrivened by a wizard:

image

Of course, I’m not a wizard; I’m not even an acolyte. The steps I took just involved (1) a certain viewpoint on probability distributions, and (2) puzzles that an 11-year-old could solve. 

This is how formulas in textbooks get to look so daunting.

 —skippable interlude— 

I guess I figured this out years ago, when I first saw the Black-Scholes-Merton formula in business school.

image

The BSM is just a continuous-time limit of “Did the stock go up or down in the last 5 minutes?” But the BSM is dressed up with such frightening language that it seems much more inscrutable than “A tree generated from two alternatives which are repeated”.

\frac{\partial V}{\partial t} + \frac{1}{2}\sigma^2 S^2 \frac{\partial^2 V}{\partial S^2} + rS\frac{\partial V}{\partial S} - rV = 0

For example in the Wikipedia article on BSM the subheads include: Greeks (), elliptic PDE’s, derivation, interpretation, criticism, extensions of the model, notation, assumptions, references. It’s 24 pagedowns long. From this pretence of sophistication follows:

I’ve seen it in biology, chemistry, and physics textbooks as well. A convoluted formula encodes the results of a simple model. Because of scientism the students commit it to memory as well as more derived results. Hopefully they come to find that it was not so complicated only a professors could understand it.

But I don’t think that’s common knowledge, so formulæ retain an impenetrable mysticism and the rituals of uncomprehending repetition continue.

 —back to the main idea— 

It needn’t be so enigmatic. I can demonstrate that by showing how the ugly beast above looks if you break it into steps. It’s simpler as several lines of code than as one formula.

Client Request

Anonymous Monk wanted a probability distribution like this:

image

with the median at x and equal probability masses between [x/y,x] and [x, x•y]

Drawrings

I’m going to take a Gaussian and map the endpoints to what the client wants.

image

The result will tend to the centre a “normal” amount of the time and yet will be squashed onto the domain the client wants.

Match up the Endpoints

I know that exp maps (−∞,0] onto (0,1]

To follow that, I need a transformation that will match (0,1) to (x/y, x). So 1 ⟼ x and 0 ⟼ x/y.

0 ⟼ x and 1 ⟼ xy

as 6 lines of Code

my $random = ...; #Gaussians, however you fry them up
if ($random <= 0) { 
$random = exp($random); #map (−∞,0) → (0,1)
$random =     ; #map (0,1) → (x, x•y)


}
else { #map (0, +∞) → (0,1)
$random = 1 − exp(−$random);  #map (0, +∞) → (0,1) ... which is the same problem as above except backwards
$random =     ; #map (0,1) → (x/y, x)

Lessons:

  1. use paper first, write code second
  2. draw a picture
  3. if necessary, break it into a simpler picture
  4. compose the answers to the parts
  5. code the pieces in separate lines

The equation at the top does decompose into the sequence of steps I just outlined. But even though it looks simple as a sequence of steps, the one-line formula is scary.




It’s not universally agreed that mathematics is the worst subject everyone has to study in school, but I would say the agreement is close to universal. Why is it so boring?

Aesthetically, I prefer non-miraculous explanations that don’t invoke unique, incomparable properties of the thing considered. So for example I wouldn’t like the explanation that $AAPL is a $10^8 company because of “the magic of Apple”. I would prefer an explanation that involves definite choices they made that others didn’t—like that the Walkman was quite old when the iPod came out and they correctly assessed what the average consumer wanted and spent the right amount on an ad budget, and so on.

Even if it’s about company culture, there are probably some mundane, tangible, doable actions or corporate structures that cause culture—Greg Wilson pointed out, for example, that code is less tangled when multiple programmers are less separated in the organisational chart.

 

So here’s a theory of that aesthetic kind, about why mathematics is different from other subjects and ends up being taught worse.

  • The model of one teacher with a chalk and a blackboard, is more insufficient to explain mathematics than it’s insufficient in other subjects.
Here are some differences between mathematics and other subjects—not incomparable differences like “Well mathematics has group theory" or "Mathematics is for logical minds"—but comparable differences.
  1. One doesn’t become conversant in mathematics—like knowing the basic grammar and syntax—until after 3 years of upper-level courses. Typically linear algebra, analysis, modern algebra, measure theory, and a couple applied topics are required before one could be said to “speak the language”—not to be like Salman Rushdie with English, but to be like an 8th grader with English. So whereas an English teacher who went to university was working on honing skills and developing to a level of excellence, a maths teacher who went to university was becoming functionally literate.
  2. Visuals are necessary to teach mathematics. An ideal lecture in geometry would have heaps of images, videos, and interactive virtual worlds. Virtual worlds and videos take a long, long, long time to create compared to for example a lecture in history. History can be told in a story, whereas talking about for example hyperbolic geometry is not really showing hyperbolic geometry. Sure, a history lecture is nicer with some photos of faces or paintings of historical scenes—but I can get the point just by listening to the story. See my notes on a lecture by Bill Thurston to see how ineffective words are at describing the geometries he’s talking about.

So it takes longer to program a virtual world or a video than it does to write a story, and it takes longer to become functionally literate in mathematics than it does to become functionally literate in history.

Suddenly we’re not telling a story about mathematics being a special subject area with unique problems that can never be overcome. We’re not talking about heroes or villains or “Mathematics just is boring”. (Which is a ridiculous thing to say. That’s saying the way things currently are, is the only way things could ever be. “Mathematics by some intrinsic, unique, incomparable property is more boring than, say, history.” In reality, either can be taught in a boring way and yet both topics have interested people for thousands of years.) Now we’re telling a story about a subject in which it takes a lot of resources to produce a talk, compared to a subject in which it takes fewer resources to produce a talk.




It is never in good taste to express the sum of two quantities as

  • 1+1=2.

[Everyone] is aware that

and further that
  • 1=sin²q+cos²q

In addition, it is obvious to the casual reader that

  • .
Therefore equation (1) can be rewritten more scientifically as:
  • .

by John Siegfried in the Journal of Political Economy. Hat tip: @unlearningecon

(Source: twitter.com)




I’ve explained group theory to fifth graders. People who haven’t tried it don’t realise the difference between explaining something to a group of a group of 8th graders, a group of 5th graders, a group of 2nd graders, or a group of college freshmen.

How did I do it? I used salt and pepper shakers. I talked about horsies and doggies. It may sound funny, but it’s actually just effective. Today’s mathematicians think that if something isn’t unreadable, then it can’t be serious, worthwhile, or good. But obfuscation doesn’t make something more valuable; just the opposite.

My advice is to write the opposite way the Bourbaki group does. Never write

when

will do.

—rough paraphrase of Doug Hofstadter




Are mathematicians deliberately obscure? Or is it really so hard for them to write prose?

Check out this description of σ-algebras from Wik***dia.
BAD:

In mathematics, a σ-algebra (also sigma-algebraσ-fieldsigma-field) is a technical concept for a collection of sets satisfying certain properties.[1] The main use of σ-algebras is in the definition of measures; specifically, a σ-algebra is the collection of sets over which a measure is defined.

No sh_t? It’s technical? And it satisfies properties. You don’t say.

The kernel of that paragraph is just one sentence.
GOOD:

In mathematics, a σ-algebra is a measurable collection of sets.

I changed the W*****dia page at 8:40pm on 3 Mar ‘11. Let’s see if I get in trouble. (I bet if I do it will be for “not being rigorous” or “original research”.)

Yes this is a specialist topic, but that doesn’t require gobbledegook. A σ-algebra is measurable like , but is not ℝ. Why can’t we just use normal words?



UPDATE: It hurts to be this right. My changes were reverted about an hour after I put them up. Am I wrong here?

I’m reminded of a story Doug Hofstadter told us about a friend of his who submitted an article in clear, everyday language to an academic journal. According to DH, the journal’s editors rejected the piece, saying it was too unprofessional. They confused jargon with sophistication, bombast with wisdom.

I don’t know the friend’s name or the journal’s name, and I half-wonder if I am just being a pr$ck about this Wikipedia article. But no, think about how people react to the word “maths”. This has got to be the reason—this and boring maths classes. Mathematicians literally refuse to write simply.

UPDATE 2: Another offender is the article on compact topological spaces. I’m actually removing some text from the garbled lede when I say:

In mathematics, specifically general topology, a compact topology is a topological space whose topology has the compactness property.

I think I’ve found a new candidate for worst sentences in the English language. Does anyone have George Orwell’s e-mail address?