Insights by Danielle Fong

notes from a girl from the future

Category: Math

Acceptably Nonterrible Revision Control for Mathematica

I discovered today, to my amazement and horror, that the otherwise exceptionally advanced and useful Mathematica 7 has only a single level of undo in its notebooks. And no redo.

Furthermore, the lone autosave feature, hidden deep, is triggered upon every cell evaluation. Every time you evaluate something in a notebook, it will save the file – overwriting the last version.

I spent an hour looking to see what was the matter. I was convinced that it must be my own obtuseness causing me not the find or see or properly use the actual undo function there present. Instead, I found several newgroup threads in which people exclaim their amazement that such vital features as multiple undo and revision control hadn’t made it in, and apologists of various employ, Wolframites and others, who wrote back about the academic difficulty inherent in making multi-level notebook undos for notebooks fed with dynamic data.

I’ve got news for you Wolfram Research. It doesn’t matter. What people care about is their input data. What people don’t want about is destroyed work – the product of their labor, channeled through from their mind and out through their fingers, typed into little, nicely formatted cells. Almost everything else can be reconstructed from that input. The cases in which the inability of a simple multilevel undo to capture changes in dynamic data could possibly destroy work make up a fraction of a percent. Catastrophic hard disk failure is more likely.

I checked for a while to see if anyone found a solution more advanced than to manually save often, and use standard revision control. I couldn’t find anything.

Thus, I present my complete hack of a solution. It seems to work acceptably well — as in, I think I can rely on it to save my work, most of the time, if it really came down to it. But use at your own risk:

1. Get Dropbox. (getdropbox.com) This is a file sharing and revision control system that’s built right into the operating system, Windows, Mac OS X, Linux. One creates a folder, shares it over Dropbox, and every file in it is mirrored, automatically, on their servers. In particular, they keep track of revisions: so far as I can tell, every saved file is queued to be uploaded.

2. Enable Autosave. One can set this for the current notebook by evaluating the following line: SetOptions[SelectedNotebook[], NotebookAutoSave -> True]. This setting persists across saves.

3. Now every time one evaluates a cell, the notebook is saved. Further, while the file is apparently overwritten locally, the revision history (which I believe is, in most cases in full,) has been uploaded to Dropbox, or queued by the client.

4. To recover a revision, one can check the revision history in the Dropbox web interface.

5. Standard diff facilities are less useful, because the notebook files are highly structured. However, there’s a structured diff built into Mathematica, Notebook Diff in the AuthorTools package. One loads the package by evaluating << AuthorTools`. One can run this command NotebookDiff[nb1,nb2], where nb1 and nb2 are either notebook objects or their filenames with full paths.

This seems to work well enough for now. In the meantime, Wolfram Research, get your act together! You are driving people crazy.

I am also putting together a way to use the Units` package throughout (much more of) Mathematica, in particular, in conditionals and numerical functions. In practical engineering it could often be said that converting units is one’s primary occupation. For this reason the units package came to me with extreme promise. Built into the algebra package as it was, it could be used, in an extremely simple way, to check dimensional and unit consistency. However, it is not natively compatible with numerical functions: one cannot plot expressions including units, or expect results from comparison operators, and they can’t be used with functions like Max and Abs, or within the solver for numerical differential equations. It would be so wonderful if it could. I think I’ve figured out a way forward there, but we’ll see. The basic idea is to set to 1 all base units in a particular unit system — SI or CGS. This is likely to work for mechanics, however due to the differences in how the CGS and SI systems define electromagnetic quantities, making it work well for electromechanics is either a subtle project, or a doomed one. [Edit: David Park’s ExtendUnits package appears to do exactly this. It’s $30, though. http://home.comcast.net/~djmpark/UnitsPage.html%5D

Also, I don’t know if anyone’s really following this, but we’re not working on vehicles specifically anymore; LightSail is directing itself towards energy storage as a first product. Our website is woefully out of date. Vehicles or vehicle systems may be a further product and direction of ours, but by focusing on energy storage we can really prove out the core technology without the additional hassles of becoming an automotive company.

The Choice of Work

During the back and forth of exchange with a technical recruiter, he finally asked me what I was looking for. And so the floodgates opened.

This may sound weird, but I pretty much choose employment based on the promise of quality work. Other factors fade into irrelevance.

When I say quality of work, I mean more than the work environment, more than the magnitude of technical challenges, and more than the IQ of those I’d be working with. I want the opportunity to walk paths with the greatest hope of leading to first-class work. Nobel-prize winning kind of work.1 This force guides me, and so inevitably I tend upstream of technological change. Money and prestige are mere proxies for what I really want: to develop and inspire fundamental changes in the way people live. That doesn’t mean I need tackle the greatest problems humanity now faces (yet). What matters is that I, personally, have a reasonable approach. So I must always remind myself to, as Richard Hamming says, ‘plant the little acorns from which the mighty oak trees grow’ — because small projects can, swiftly and strikingly, grow momentum and value.1

I find little value in submitting myself to some company culture. I instead mean to develop my professional values, ambitions, and goals: for example, I would like to develop new methods, make them available by open sourcing them and make them popular by evangelizing them. I’d love to be given the chance to teach what I’ve learned. Excellent people bring ideas and perspective to a communities of makers. Given time, I think this will evolve naturally into a company culture worth having.

Most big companies grow faster than they could build trust, to a size greater than strong values can be supported. Natural culture is the product of alignment of creative philosophies, and in BigCo, this is too often replaced with virtual company nationalism. Fascism even. I find this is more than distasteful. I haven’t really learned how to work within it at all. I could devote my efforts to such an organization only were there deeply meaningful work to be done. And why bother?

Paul Buchheit's first Google Check.

Angling to be upstream of technological change, I bait unusual questions and find surprising answers. Give me the choice between a VP position at a big five media company with oodles of benefits, and, say, work at an early netscape or google for a totally minimal salary, and I’ll choose the latter every time. I’m pulled towards organizations where I can learn about organizing, rather than learning about institutional tradition. It’s not important for me to learn about how to run a large organization: if ever I do, I won’t follow of the paths of current captains of industry. Instead, I intend to help grow large, leaderless, open organizations, and so I’d do almost anything for a chance to work with Caterina Fake, or Linus Torvalds.

I want to work on something I find deep personal meaning in. I strongly believe in supporting open culture. I don’t think I’d work for long in games or entertainment unless it could influence some social change. I worked at MochiMedia because it made possible an income stream for small independent developers where none existed before. This finally opened up professional game development from BigCos. Now, much innovation in gaming emerges from bedroom studios. Independent game developers can now commit to their art in a way they before could not.

Similarly, I’d work at YouTube rather than Hulu, even though one’s a startup and the other isn’t, because they’re more interested in involving everyone in the process. As Clay Shirky says, they’re interested in ‘finding the mouse’.

I want to work somewhere where I can truly make a difference. Why am I working in technology at all? Archimedes once said, ‘If you give me a lever and a place to stand, I can move the world.’ Technology is my lever. I need only find place to stand. This makes me wary of startups that try to do good, but aren’t particularly focused on doing it efficiently. I wouldn’t work for most charities. There’s too little pressure on them to focus — the tempering influence of market competition is replaced by government demands for ‘accountability’, which arn’t nearly so powerful.

There are numerous ‘ecogreen’ websites out there that try to promote simple, green ways of living. These may be virtuous, however, in terms of minimizing environmental impact I think they’re somewhat irrelevant.2 Saving plastic bags won’t lift a toe on our carbon footprint unless we find ways to either cut down on air and automobile travel, or do it more efficiently. And on carbon footprints — global warming is, I think, a red herring — there are thousands of nasty effects of pollution from, say, coal-fired power plants that will hit even if global warming doesn’t occur (though I think, probably, it will). Too much of China now wears breathing masks.3

I can see myself dedicating myself to the right company, so long as our goal, philosophies, and ambitions align. Yet these are stringent requirements. So far, then, I’ve found it necessary to reserve some energy and time for my own projects. So I must be open with companies: with most, I want only consulting work, to help them with some particular project, idea or problem. And I want to be completely, totally honest with everyone about it, because so far, the high road has never let me down.

Sincerely,
Danielle

———

Notes:

[1] – From the classic talk by Richard Hamming, You and Your Research. I don’t, particularly, apologize for my ambition here. Why shouldn’t I try to do first class work? The Nobel prize winning part is purely incidental. But this is the kind of work I mean — a significant contribution, one that people can build upon.

[2] – The free, online book Sustainability – Without the Hot Air is an excellent read. It is the first thing I’d suggest to someone interested in seriously starting into environmental matters. I shouldn’t claim that small contributions to green living are completely irrelevant — each does have some small effect. Perhaps raising the issue of green living in our collective consciousness will have an effect greater at second order than I imagined. But so many of our behaviors are misplaced. Many people, for example, go out of their way to buy ‘sustainable’ products at Whole Foods, say, when in reality, longer vehicle trips do more damage than almost anything you could buy. Many things are sold in a way to make you feel good about buying them. They don’t have any real effect!

[3] – This is worded provocatively, but pollution in China is a growing catastrophe. See ‘As China Roars, Pollution Reaches Deadly Extremes’ and ‘Where Breathing is Deadly’.

———


Thanks to Alex Lang, Ma’ayan Bresler, Nick Pilon, Colin Percival, Michael Nielsen, and Joel Muzzerall for reading drafts of this, and Charles Beatty, for sparking it.

PS: Certain misconceptions have been raised. Some feel that this is one demand of an over privileged generation. I reply to this here. Additionally, I am not, in fact, abandoning my startup. But I do need money, and a visa, so I am looking into either employment or seed funding.

Blue Eyed Islanders. (A Logic Puzzle)

Terry Tao’s recent post on a classic logical puzzle has seeded a bloom of activity in the nerdsphere. A friend of mine introduced it to me over mugs of steamed milk in the graduate college coffee house; I was telling him of recent work I’d been doing on the soundness of emergence of Nash equilibria, and where sufficient conditions arise in real life.1 It was an enjoyable conversation, though I wasn’t afforded the luxury of working it out for myself. If you’d like to struggle through the problem on your own, read Terry’s post, and only return after the break when you think you’ve solved it. (why am I writing this? It started as a comment on news.ycombinator.com, and I couldn’t help myself)

This problem is subtle, and wording is important, so I’ve reproduced the statement from Terry’s blog (emphasis mine) [editor’s note: Terry didn’t intend for a particular subtlety, and so has reworded his main post. He says that it had an ‘unexpectedly interesting subtlety in its formulation, but was not the puzzle I had actually intended to write’. He’s posted the original here]:

There is an island upon which a tribe resides. The tribe consists of 1000 people, 100 of which are blue-eyed and 900 of which are brown-eyed. Yet, their religion forbids them to know their own eye color, or even to discuss the topic; thus, each resident can (and does) see the eye colors of all other residents, but has no way of discovering his or her own (there are no reflective surfaces). If a tribesperson does discover his or her own eye color, then their religion compels them to commit ritual suicide at noon the following day in the village square for all to witness. All the tribespeople are highly logical and highly devout, and they all know that each other is also highly logical and highly devout.

One day, a blue-eyed foreigner visits to the island and wins the complete trust of the tribe.

One evening, he addresses the entire tribe to thank them for their hospitality.

However, not knowing the customs, the foreigner makes the mistake of mentioning eye color in his address, remarking “how unusual it is to see another blue-eyed person like myself in this region of the world”.

What effect, if anything, does this faux pas have on the tribe?

I’ve italicized the statement hosting the subtlety. It is known to everyone that if any tribemember discovered his or her eye color, they would dutifully commit suicide at noon the following day. And yet. The statement cleverly leaves open whether every person knows that every other person is as logical, or as devout, or as committed to the duties of ritual sacrifice, as they are.

To jump the gun, the statement doesn’t explicitly state the logical nature and devoutness of all tribespeople as common knowledge.

Hopefully examples will deliver me from vagueness. Consider tribes with one, two, and three blue eyed people on islands Galileo, Hippasus, and Russell. 2,3,4

On Galileo, after the gaff, the sole blue eyed unfortunate notices that none of his people share his tint of iris, and reconciles himself to a midday doom.

On Hippasus, one day later, our fated blue-eyed duo, fully aware that the other would have extinguished were he or she the only blue eyed resident, are forced to draw the conclusion that they are blue eyed, and so they disappear.

But on Russell, confusion sets in. Three blue eyes islanders know the two others. They know that each would commit suicide if they discovered their eyecolor, and they know that on the previous two days, no such thing happened. It would seem that the group would meet a bitter end. As the reasoning usually goes, each of the three, knowing the other two, would infer that the others continued survival could only mean the existence of other blue eyes on the island — theirs!

But wait. Let’s examine this more closely: take the blue eyed islanders, let’s call them, err, Alice, Bert, and Cecil. Alice sees Cecil and Bert; she knows that they as well as the rest of the tribe, and knows they’d indeed follow protocol if either discovered their eye color. What she doesn’t know for certain is whether Bert knows that Cecil would kill himself over eye pigment (even though he in fact would). Therefore, she doesn’t know for certain that a tribe with two blue eyed members would homogenize itself on the second day, she only knows that this would be true were she one of the members. She therefore cannot deduce that she has blue eyes, and the tribe’s taboo keeps information from spreading any further. Our trio is saved. 5

What would happen if all islanders knew that all islanders followed the same rules (as is explained in the variant posted by xkcd)? Instead of confusion, Alice would be certain that Bert and Cecil wouldn’t have survived were they the only blue eyed people, and so she must be the last. They all would die on the third day. Indeed, any group of blue-eyed 6 islanders under the same conditions would all meet their fate the same way.

There are other variants, Anatoly brings up a very interesting metaproblem where proactive tribe’s members might decide to save the others through early self-sacrifice. The analysis of this, and other metaproblems, goes very deep. It will have to be the subject of another post.

In any case, I hope I’ve thoroughly explored the magic. Or at least spoiled it!

As Terry writes,

“The remarkable thing about the puzzle, to me, is how such a subtle and seemingly academic change in the knowledge environment eventually propagates to have a concrete and dramatic effect.”

Notes:

I’ve been meaning to write that article for ages, in fact I was urged to do so by my friends in politics, since models from game theory such as the Centipede Game, the Prisoner’s Dilemma, and Mutually Assured Destruction remain dominant teaching devices, and Nash equilibrium strategies continue to be prescribed and accepted as applicable by acolyte bureaucrats. Yet I’m writing this article, and not that one. The power of social news compels me.

Galileo was famously persecuted by the Church due to his advocacy of essentially logical methods and conclusions. (though you probably already know that)

The philosopher Hippasus was said to have been either expelled from the Pythagorians or drowned at sea for his proof that the square root of two was irrational.

While Bertrand Russell’s magnum opus, the Principia Mathematica, was doomed at inception due to the underexamined implications of self reference, in this case, letting meta-knowledge probe only so deep means our Russellian islanders are saved.

I’m aware that some may object: ‘but doesn’t “and they all know that each other is also highly logical and highly devout” imply common knowledge?’ I concede that this might be an interpretation in some English. Not mine; what kind of language distinguishes knowledge from meta-knowledge but not meta-knowledge from meta-meta-knowledge? Sounds illogical. Oh wait.

A common misconception is that the brown eyed people would die too. But that’s not quite right since none of them are sure that their eyes aren’t actually green, grey, or magenta.

Incompleteness and Halting. Gödel and Turing.

The following occurred to me on a run about two years ago:

It’s not given much press, but the the Halting Problem is intimately related to Gödel’s First Incompleteness Theorem. Indeed it produces it as a correllary. Historically, Gödel’s incompleteness results were proved by hacking arithmetic into a Turing complete system, and this is still how they’re explained today.

There’s a one-to-one bijection between computability of a function and provability of a statement. Hence, the short, and generally accessible proof that the Halting problem is not in general computable for an arbitrary input is also a proof of the ‘most important, surprising result in logic’, namely, that some results, which have may have a perfectly valid truth-value outside a system, cannot be proven within it. One only needs the notion of a computer to follow this line of thinking, which is, in essence, what Gödel did. But the Halting problem is much easier to grasp. I’ve had children understand it, though it does take some walking through!

The interesting thing about the Halting problem is that it’s unsolvable in full generality, independent of whatever special capabilities the system has available. To see this clearly, consider the proof.

Question: Does there exist a (halting) program H which, given any program P, figure out if it would halt, for any input I?

Assume there exists such a program H. Construct a program T as follows.

(Program P, Input I) => (Boolean Halts):
if H(P,I) is true run forever
otherwise halt

Now, call T on itself, with itself as an input. Our assumption presupposes that H always halts. If T would halt on input T, then T will run forever. And if T would run forever on input T, then T would halt. This is a contradiction, so no such program H would exist.

Read the rest of this entry »

On Outliers: What they represent, and why the Central Limit Theorem is Typically Off.

A Bell Curve

The central limit theorem states that if you have many small, independent, random variables, then their sum is distributed approximately as a bell curve. Strikingly, almost everything is made up of many small parts, and these parts don’t tend to influence each other very much.

So much of what can measure seems to fit a bell curve. This is why the normal distribution works. Because this assumption tends to work well, it is usually taken as a matter of course. Students are taught it, lecturers preach it, researchers apply it, and startlingly few stop to question it.

Suppose the variables are not small, or suppose they’re not independent. Suppose, under certain conditions, the value of one variable would seriously effect another. Suppose we’re talking about the buildup of snow on a mountain slope. Most of the time, snowflakes can gradually build, without significant effect. But once enough builds, you don’t find snowflakes resting calmly upon a drift. What you find is an avalanche.

Violent nonlinearities...

The sum total of snowflake movement isn’t what we might expect. The snowflakes on the top used to be lightly packed by the new, gradually coming down. The snowflakes on the bottom used to just sit there. But they’re not just sitting there. They’re moving fast, and they’re moving down.

Read the rest of this entry »

Quantum Field… Finance?

One morning around the graduate college dining hall, there was a gathering of physicists, finance students, and economists. The physicists are always quite amazed by those people who decide to forgo the life of the ivory tower, and choose to strike out into the real world, and so could not be kept from asking what the economists actually did. Furthermore, we could not be kept from wondering aloud what type of mathematical models they built and polished, and whether any of them had a physical interpretation.

One of the economists scratched his head, drew a sip of black coffee from his porcelain cup, and mumbled something about how a large proportion of the physics department of Harvard University was hired by a trading company, with the lure of riches beyond the pale of the meager imaginings of the physicists (“you mean I can afford a house?!”).

Read the rest of this entry »