Sunday, November 01, 2009

Sirigannadam Gelge!

Happy Rajyotsava, dear reader! Instead of the usual fare of putting up "Udayavaagali namma cheluva kannada naadu" as my status message, I decided to go a wee bit further and quote a full song. 'Enda Endti Kannada padgOL' ('Booze, Wife, Kannada songs') by the amazing, amazing, amazing G.P.Rajaratnam is, well, amazing, amazing, amazing! It's from his 'Ratnana Padagalu', a drunkard's view of the world. The humor and intelligence in the song comes mainly from the use of drunk-slang and vernacular, which might be hard to understand if the song is not heard. So I'll post the original song, and my 'translation' of the song into more standard Kannada. I can't even imagine translating this to English! As always, please help me out if I've made any mistakes.

(In case you are having some font issues, here's a small PDF of this blog)

ಎಂಡ ಎಂಡ್ತಿ ಕನ್ನಡ ಪದಗೋಳ್

ಎಂಡ ಎಂಡ್ತಿ ಕನ್ನಡ್ ಪದಗೋಳ್ ಅಂದ್ರೆ ರತ್ನಂಗ್ ಪ್ರಾಣ, 
ಬುಂಡೇನ್ ಎತ್ತಿ ಕುಡುದ್ ಬುಟ್ಟಾಂದ್ರೆ ತಕ್ಕೋ ಪದಗಳ್ ಬಾಣ.

ಬಗ್ವಂತೇಂದ್ರಾ ಬೂಮೀಗಿಳ್ದು ನಮ್ ತಾಗ್ ಬಂದಾಂತನ್ನು,  
ಪರ್-ಗಿರೀಕ್ಸೆ ಮಾಡ್ತಾನ್ ನಮ್ನಾ ಬಕ್ತನ್ ಮೇಲ್ ಅವನ್ ಕಣ್ಣು.  

ಎಂಡಾ ಕುಡಿಯಾದ್ ಬುಟ್ ಬುಡ್ ರತ್ನಾ ಅಂತ್ ಅವನ್ ಎನಾನಂದ್ರೆ, 
ಮೂಗ್ ಮೂರ್ ಚೂರಾಗ್ ಮುರ್ಸ್ಕೊಂತೀನಿ ದೇವರ್ ಮಾತ್-ಗಡ್ ಬಂದ್ರೆ.  

ಎಂಡಾ ಬುಟ್ಟೆ, ಎಂಡ್ತೀನ್ ಬುಟ್ ಬುಡ್ ಅಂತವ್ನೇನಾನಂದ್ರೆ, 
ಕಳದೊಯ್ತ್! ಅಂತಾ ಕುಣುದಾಡ್ತೀನಿ ದೊಡ್ಡದೊಂದ್ ಕಾಟದ ತೊಂದ್ರೆ!  

ಕನ್ನಡ್ ಪದಗಳ್ ಆಡಾದೆಲ್ಲ ನಿಲ್ಲಿಸ್ ಬುಡ್ ಬೇಕ್ ರತ್ನಾ  
ಅಂತವನಂದ್ರೆ ದೆವ್ರಾದ್ರೇನು ಮಾಡ್ತೀನೌನ್ಗೆ ಖತ್ನ!  

ಆಗ್ನೆ ಮಾಡೋ ಐಗೋಳೆಲ್ಲಾ ದೇವ್ರೇ ಆಗ್ಲಿ ಎಲ್ಲಾ, 
ಕನ್ನಡ್ ಸುದ್ದೀಗೇನ್ರಾ ಬಂದ್ರೆ ಮಾನಾ ಉಳ್ಸಾಕ್ಕಿಲ್ಲ!  

ನರಕಕ್ಕಿಳ್ಸಿ, ನಾಲ್ಗೆ ಸೀಳ್ಸಿ, ಬಾಯ್ ಒಲ್ಸಾಗಿದ್ರೂನೆ!  
ಮೂಗ್ನಲ್ ಕನ್ನಡ್ ಪದವಾಡ್ತೀನಿ ನನ್ನ ಮನಸ್ ನೀ ಕಾಣೆ!  

ಎಂಡಾ ಓಗ್ಲಿ, ಎಂಡ್ತಿ ಓಗ್ಲಿ, ಎಲ್ಲಾ ಕೊಚ್ಕೊಂಡ್ ಓಗ್ಲಿ,
ಪರ್ಪಂಚ್ ಇರೋತಂಕ ಮುಂದೆ ಕನ್ನಡ್ ಪದಗೋಳ್ ನುಗ್ಲಿ!


My 'translation' into 'normal' Kannada:

ಹೆಂಡ, ಹೆಂಡತಿ, ಕನ್ನಡ ಪದಗಳು (ಪದ = song) - ಅಂದರೆ ರತ್ನನಿಗೆ ಪ್ರಾಣ 
ಬುಂಡೆಯನ್ನು (kind of bottle or small pot) ಎತ್ತಿ ಕುಡಿದುಬಿಟ್ಟರೆ (ಸಾಕು), ತಗೋ ಪದಗಳ ಬಾಣ!  

ಭಗವಂತನೇನಾದರು ಭೂಮಿಗೆ ಇಳಿದು ನಮ್ಮ ಬಳಿ ಬಂದ, ಅಂತದುಕೋ. 
ನಮ್ಮನ್ನು ಪರೀಕ್ಷೆ - ಗಿರೀಕ್ಷೆ ಮಾಡುತ್ತಾನೆ ಅವನು, (ಏಕೆಂದರೆ ಅವನಿಗೆ) ಭಕ್ತನ ಮೇಲೆ ಅವನ ಕಣ್ಣು (=concern, ಇರುತ್ತೆ; widely held view that God will test (the faith of) his devotees). 

"ಹೆಂಡ ಕುಡಿಯುವುದನ್ನು ಬಿಟ್ಟು ಬಿಡಬೇಕು, ರತ್ನ" ಅಂತ ಅವನೇನಾದರು ಅಂದರೆ,  
(ಆಯಿತು, ನಿನ್ನ ಮಾತು ಕೇಳ್ತೀನಿ. ಇನ್ನು guarantee ಬೇಕು ಅಂದ್ರೆ here, I promise,) ದೇವರ ಮಾತಿಗೆ ಅಡ್ಡ ಬಂದ್ರೆ, ಮೂಗು ಮೂರು ಚೂರಾಗಿ ಮುರಿಸಿಕೊಳ್ಳುತ್ತೇನೆ ( ನನ್ನಾಗಿ ನಾನೇ ಶಿಕ್ಷೆ ಒಪ್ಪಿ ಕೊಳ್ತೀನಿ)  

"(ಆಯಿತು,) ಹೆಂಡ ಬಿಟ್ಟೆ, (ಈಗ) ಹೆಂಡತಿಯನ್ನು ಬಿಟ್ಟು ಬಿಡು" ಅಂತ ಅವನೇನಾದರು ಅಂದರೆ, "ದೊಡ್ಡದೊಂದು ತೊಂದರೆ ಕಳೆದುಹೋಯಿತು!!" ಅಂತ ಕುಣಿದು-ಆಡುತ್ತೀನಿ! (LOL :D)  

"(ಆಯಿತು, ಈಗ) ಕನ್ನಡದಲ್ಲಿ ಹಾಡುವುದನ್ನು ಬಿಟ್ಟು ಬಿಡಬೇಕು, ರತ್ನಾ"  
ಅಂತ ಅವನಂದರೆ [instant change of mood now] ದೇವರಾದರೇನು, ಅವನಿಗೆ ಮಾಡ್ತೀನಿ ಖತ್ನ! (ಖತ್ನ = circumcision! ROFLMAO :D also, religious poke at "cutting the dick" off ನಮ್ಮ ದೇವರು :D Brilliant!)  

ಆಜ್ಞೆ ಮಾಡುವ ಅಯ್ಯರುಗಳು ( ಅಯ್ಯ = ಯಜಮಾನ) ಆ ದೇವರೇ ಆಗಲಿ, (ಪರವಾಗಿಲ್ಲ),
ಕನ್ನಡದ ಸುದ್ದಿಗೆ ಏನಾದರು ಬಂದರೆ ಮಾನ ಉಳಿಸುವುದಿಲ್ಲ!  

(even) ನರಕಕ್ಕೆ ಇಳಿಸಿ, ನಾಲಿಗೆ ಸೀಳಿಸಿ, ಬಾಯಿ ಹೊಳಸಾದರೂ ಕೂಡ,  
ಮೂಗಿನಲ್ಲಿ ಕನ್ನಡ ಹಾಡು ಹಾದುತ್ತೀನಿ, ನನ್ನ ಮನಸ್ಸು ನಿನಗೆ ಗೊತ್ತಿಲ್ಲ!  

ಹೆಂಡ ಹೋಗಲಿ, ಹೆಂಡತಿ ಹೋಗಲಿ, ಎಲ್ಲ ಕೊಚ್ಚಿಕೊಂಡು ಹೋಗಲಿ!  
(ಆದರೆ) ಪ್ರಪಂಚ ಇರುವ ತನಕ ಕನ್ನಡ ಮುಂದೆ ನುಗ್ಗಲಿ!

ಸಿರಿಗನ್ನಡಂ ಗೆಲ್ಗೆ! :-)

--
I found the original at Prof. Holalkere Chandrasekhar's pages on Kannada. It's a fantastic resource, if you can get used to the slightly jagged font in the GIFs (It'll need a revolution in many areas to be able to search Kannada, so I'm not complaining about the GIFs themselves)


Wednesday, October 07, 2009

Understanding Rubel's Universal Differential Equation

[Many thanks to HKR for convincing me to get off my lazy ass and figure this out]

Karthik, dispassionately going about his chosen avocation of introducing mind-bogglingly awesome concepts via blog comments, wrote on the previous post a differential equation:

This equation is called Rubel's Universal Differential Equation [R], and has the amazing amazing amazing property that a solution 'y' to this equation can be made to approximate to any desired level of accuracy any (continuous) function on any interval of the real line, and with C-inf continuity! In other words, this is an 'Equation of Everything'! Take anything you possibly know that is continuous. The temperature in your room as a function of time. The position of the earth in space as a function time. The velocity of a comet as a function of its distance to us. The (smoothed) variation of a stock price with time. The degree of contraction of a heart cell as a function of its location. A solution of this one equation can be used to approximate all of these to infinite accuracy, and with infinite continuity!

I'll now attempt to try to reverse-engineer this equation in the manner I tried figuring out Tupper's math quine, and hope to find a plausible way to figure out how Rubel could have come up with this.

All DEs are not born equal

Consider the trivial [1] equation y'' = 0. I can rightfully claim that this equation is the 'master equation' satisfied by all lines y = Ax+B.

The triviality bit, after a bit of thinking, leads us to a categorization: there are two kinds of differential equations. Consider the equation of SHM, y'' + y = 0. We'll call this a 'predictive' DE, because it predicts the behaviour of y, and tells us something about a physical system.

On the other hand, consider the equation: y''' = 0. Every parabola satisfies this equation, but we can't use this equation to predict anything. It's more an expression of the property of all parabolas, and so we'll call it an 'shrink' DE. It's like going to a psychiatrist to know more about yourself, but all you get is some general info that isn't predictive in any way :P

Rubel's UDE is a something like a 'shrink' DE [R2], not a predictive DE. This may come as somewhat of an anti-climax, because when we see DEs as engineers, we always assume that they are predictive. After all, every single DE an engineer uses is predictive. But note that when it was presented, it was not claimed that every continuous function satisfies the UDE; only that solutions to the UDE can be made to approach any continuous function with arbitrary accuracy. That is equivalent to the difference between saying "I have a hole that perfectly fits every shaft in the world" and saying "I have a tool that can make a hole that perfectly fits every shaft in the world."

Even if it's not predictive, there is a sufficient number of curiosities to motivate further analyzing this. For one, we are well familiar with the idea of interpolating a function piece-wise with straight lines.


We can achieve any desired accuracy by increasing the number of pieces we use, but there is one stark fact: The function that we build by stitching straight lines will have sharp corners - there is a discontinuity of some order at each of the stitch points. Even though increasing the number of pieces can reduce the least square error between the curve (called reducing "the error in the L2 norm"), the resulting stitched function will be bumpy. What precisely do I mean by bumpy?

This might seem like a childish construct from Calculus 101, but please humour me. Let's create a hypothetical car. This car has the usual odometer and speedometer, but it also has an accelerometer, a jerkometer, ... an infinite number of meters to measure every derivative of the car's distance function. By 'bumpy' in the last para, I mean that when I drive my car like the interpolated function, some of my meters jump.

Altius Fortius Happius?

We can attempt solve some of the problems of this bumpiness by using higher order interpolating functions that ensure "stronger" continuity. For example, when we use lines, we can claim at best C0 continuity. Using parabolic sections as the interpolating functions, we can, in principle, claim up to C1 continuity. (Thanks Shreevatsa) Following this path, we go into spline interpolation, but there's no way we can ensure C-inf continuity.

As an aside, the entirety of the Finite Element Method revolves around how to do this interpolation. The central property of the FEM, it's raison d'etre, is that it guarantees the best approximation to a function using a given set of interpolating functions, 'best' as measured by the L2 norm. However, higher order continuity requirements across segments are very hard to implement. In fact, even C1 continuity is very hard in 3-dimensions, and C2 continuity is exceptionally rare. It's a reasonably hot topic of research, and part of the framework Pota is working on attempts to grant higher degrees of continuity.

To summarize our conundrum, with what we already know of interpolations, we can have infinitely accurate interpolations when measured in the L2 norm (ie.. C0 continuity), but higher order continuity especially across segments is extremely hard [2]. Rubel's equation, on the other hand, claims that it can achieve C-inf continuity. How?

A detour - the Curious Incident of exp(-1/x) during the Taylor expansion-time

Consider this innocuous looking function,


It looks like this when plotted:

If you have read about statistical mechanics, you'll notice that this is a very common form. The temperature dependence of a huge number of quantities varies as exp(-1/x).

What's special about this? It is trivially provable[R1] that this function is 'smooth'. All its derivatives exist at all points on the real line. If you drove our car on it, none of your meters would ever register a sudden jump.

But there's a deep evil that lurks here that strikes terror into the heart of all real analysts (umm..not really, but I couldn't resist :P ): Look at the function and its derivatives at x = 0. All of them are identically 0. That means that if you try to write a Taylor expansion about x = 0, it will predict that f(x+h) = 0 for a small h. Holy horror! This means that the Taylor series expansion doesn't sense the rise of the function just to the right of the origin! That means the Taylor expansion can never approximate the function if we start from the origin! The function is not analytic!

This is a phenomenal event! The function is perfectly flat at the origin - perfectly flat, with every derivative zero. And yet, the function bootstraps itself into rising! This is incredible, because you never see perfect flatness in any smooth function! There will always be some non-zero derivative that will tip you off on what the function will do! But here, all derivatives are 0! Flat! Perfectly Flat!

The Insight [3]

But wait - if it is perfectly flat, then if we stitch together the perfectly flat ends of two such functions, we can have an infinite degree of continuity! How would it be if we used this as our interpolating function?

That's it. That's the central idea of UDEs. Stitching together functions in regions where they are perfectly flat. All we need to do is find a differential equation that describes one 'piece'. The stitch region has all derivatives existing and equal zero, and so will trivially satisfy our equation. That means our thread, made of many pieces and stitches, is still a solution to the DE. Which means we can claim that we can make any thread that fits infinitely accurately with any given function. We have made our tool!

Some reflection, and dark forebodings

There are some minor things we need to take care of. In the function we described above, we have only one perfectly flat end. It's cumbersome having to flip the function around every time we need to stitch, and so a little bit of playing around gives us this function that has two perfectly flat ends:




(This is called the bump function.)

Uh oh. Wait a minute. We're screwed. Look at that function again. Our fundamental 'piece'. It doesn't do anything! It is zero, then rises, and is back to zero again! Forget about anything else, how can you stitch together pieces like this to form a simple parabola, say y = x^2 ? The piece as a whole doesn't rise or fall!
Note that even if we rotated this thread, we couldn't change the shape of the thread. Our thread of stitched functions can never deform!

Our knight in ∫hining armour

The solution to this problem is (imho) the second most brilliant insight in the paper. What is it that we love about the bump function? The fact that it's perfectly flat at the ends. What don't we like? That the function ends where it begins, and is on the whole flat.

Wait a minute - the function is perfectly flat at the ends - it doesn't matter if it lost a derivative! Eureka! We can integrate the function, and this makes it an increasing function on [-1,1], while still preserving perfect flatness at the ends! Here's what the integral of th function looks like:


Rubel calls these integrated functions 'S-modules', because of their shape. That's it, we've found our perfect interpolating piece: perfectly flat at the ends, and increasing monotonically over the interval [-1,1].

Observe that in Rubel's UDE, the lowest degree in which y appears is y'; There's no term with a raw y. This is what originally tipped me off into suspecting that there was an integration involved.

Cleaning up

Now the task is to simply write down a differential equation for the S-module:
(t is the abscissa) and write a generalized function of this with constants, such that it can be moved (translated) in the two directions and scaled in width and height. Some algebraic trickery to eliminate the constants and the abscissa follows. The exact thing to be done, as Rubel states, is:

and eliminate A, alpha, beta, B and t from these 4 equations.

Once that is done, we have a shiny UDE
all set for world domination. The exact details of the algebra can be found in Rubel's original paper, and I hope after reading this you will also be able to follow his very pithy style. The only catch is that our function will not be analytic at (i.e. cannot be expanded in a Taylor series around) the stitches. But so far as I know, there's no way to detect this sitting in our hypothetical car, so all's well.

Some Puzzles

We aren't fully done with Rubel's paper yet; he claims that his UDE is an analog to universal Turing machines. There is also much talk on Hilbert's 13th problem, and a classic proof by forthcoming publication [4]. I don't quite see the connects yet, and will update this if I figure it out.

Other UDEs

I skimmed through some of the others in the field, and have a rough idea of how they work (ooh don't you just love the sound of 'skim' 'rough idea' 'general sense' 'intuitive feel' ?). Of all of these, Rubel's is the most straightforward; but that may be because I spent the max time on him.

Duffin's paper in the PNAS [R] is a poor man's UDE: it has a parameter 'm', and the solutions are guaranteed to be Cm continuous. It's nice that he was able to condense a simple polynomial interpolation into one equation.

Brigg's paper [R] uses another trick to generate 'perfect stitches' - he uses Jacobi elliptical functions that are periodic in a chosen interval, and therefore have all derivatives the same. It's a nice extension to Rubel's 'perfectly flat' insight.

There's another paper by Boshernitzan [R] that's very interesting: he guarantees not only Cinf smoothness, but also everywhere analyticity. The price we pay is in our domain. We can no longer have our function spread on arbitrary domains. It has to be a compact region of the real line. Again, I don't understand precisely how he does this, that's for another day. Elsner's E functions [R] are worth a look, too.

Commentary

There are two very nice insights in this paper - a general one of using an interpolating function with perfectly flat ends to ensure Cinf continuity, and specific one of deciding to use an integral of a bump function. Apart from that, there isn't any more information content in this UDE than in a least-squares fit equation.

My first (wrong) instinct was to think that the 'n' in Brigg's equation held information about the function. I thought that varying n would make the differential equation plot out different graphs. This is very similar to Tupper's idea in his math quine (the constant 'a' in my explanation). Raghu then pointed out that Rubel's original equation had no parameters. But if you think about it, we can indeed make a predictive UDE with one parameter that cycles through all functions. This essentially requires a constructive proof (as opposed to a simple existence proof) of the bijection (one-to-one ness) between the set of reals (our parameter) and set of infinite number of reals (the values of the function at 'every' point). Let's see if I ever can get to that level of joblessness in life :-)

I'm still amazed and can't quite fully digest the fact that a perfectly smooth function can be non-analytic. I mean, consider the exp(-1/x) function. If you stand at the origin, you have no clue what happens as you step forward! All the meters in your car will read zero at the origin, and yet, somehow the function bootstraps itself into rising! This never happens with analytic functions! If any aspect of a function has to change, (y, y', y'', y''', etc), then it can always be seen as being caused by a change in a higher derivative. For example, if you're going in our car near the apex of a downward-facing parabola centered at the origin, you'll see that y = 0 and y' (your speed) = 0. But your acceleration is not zero! So you can always predict what happens at the next moment using the info the car displays at this moment. We have so far thought that the only time you can't predict is when there are discontinuities - i.e, a 'god' tweaking the function definition. But here, there is no tweaking, and yet you can't predict! I'd instinctively think that infinite smoothness means that every point contains info that allows me to transverse every other point in the function. Apparently that is not so. This is a ripe area for some thought experiments, and I'll write more on this if I discover more.

My aim in writing this post is to provide a plausible way in which Rubel could have come up with his UDE. Almost the only way I can understand something is to mentally re-build it from scratch, so I hope this will be of help in clearing up some of the ideas. Though unavoidable when introducing a new topic, every 'Consider' is a non-sequitur. I've tried to minimize those, and the only place where a real detour is required is the idea that a function like exp(-1/x) exists.

References

[1] A joke about the use of the world 'trivial' in Mathematics on the wiki:
Two mathematicians are discussing a theorem. The first mathematician says that the theorem is "trivial". In response to the other's request for an explanation, he then proceeds with two hours of exposition. At the end of the explanation, the second mathematician agrees that the theorem is trivial.

[2] It's in bad form to ask why higher order continuity is required. It just is. It's also like asking why a real Peugot 206 is better than the one in this lovely ad.

[3] I couldn't resist using the [Blink] tag, just so that I can refer to this old classic. Many thanks to HKR for rediscovering this!

[4] A most lovely list of invalid proofs. My favorites are 'proof by forthcoming publication', 'proof by exhaustion (of audience)', 'proof by reference to inaccessible literature' and 'proof by funding'.

References, the real ones

[R] The Mathworld article on UDEs contains a list of all the works I have referred to here. That was also the first place I heard about UDEs.

[R1] The wikipedia page on Non-analytic smooth functions has a simple proof. I wish it were longer and had more discussion, though.

Also, Tim Gower's essay on continuity is a refreshingly clear read (compared to the shitstorm of epsilons and deltas rife in most analysis textbooks).

[R2] To tell the truth, y''' = 0 is not such a bad fella after all. It's still telling us a physical truth - that the curvature of a parabola is constant everywhere. Rubel's UDE on the other hand isn't telling us anything about the world! It is only we who observe that the solution to the UDE has some use as an interpolating function, and it is we who build the approximation. Talk of outsourcing, man!


:-)

Tuesday, September 29, 2009

BB0 - The Uncanny Valley of computational research

(This is the pilot episode of what I hope posterity will remember as the Blood-curdlingly Boring series. I hope to shamelessly present my biased opinions on everything in this world with such a staggering lack of perspective or balance that my gentle readers would have to watch many episodes of Pati, Patni aur Woh to recover their basis in reality. I hope to wax eloquent on topics so far beyond the reach of my meagre experience or intellect that my helpless readers would be rather host a Windows 7 Launch Party than read this drivel.

Worthy though it is, I make no vain claim that this noble aim is mine in origin; I am but a humble follower in the brilliant path of boredom and mindless metaphor carved out to escape the dark, dense forest of sense by my illustrious seniors. As Kalidasa writes when he begins the Raghuvamsha [1], my journey is an easy one, like that of a thread through a jewel which has already been bored through by a diamond... holy burnt crap, enough of this, let me get to the point.)

(Update, Oct 17: Greatly expanded with the aid of Chandru, the most inexhaustible source of all fundaes on postgrad in IITM. He also insists that this post gives a biased view that only modeling sucks, and so an edition detailing the heinous atrocities and frauds of experimental research is forthcoming.)

I've been very irritated by almost all of computational modeling research I've been reading up on. I specifically mean research in modeling and simulating systems that we (humans) have not built from scratch. For example, trying to model blood flow in an artery, or the mechanical behavior of tissue or modeling the weather. It struck me that this situation is similar to an idea in human-robot interactions, called the Uncanny Valley.

(Image, as mostly everything you'll find on this blog, from Wikipedia)

This is a graph of a feeling of 'familiarity' or 'liking' vs how human a robot looks. Near the left, an object, say a robot, looks nothing like a human (for example an industrial press) and there's no feeling we attach to it. As it starts to look more and more humanlike (like for example the Asimo), people start finding it 'cute' and likable. But then, as it as it gets to the point of being almost human, uncannily human, there suddenly is a repulsion for it, a kind of disgust like what we feel for a prosthetic or a made-up corpse. Further on however, we're barely able to make out the difference and the familiarity rises up rapidly.

I think a very similar effect occurs in modeling. In the beginning, models are simplistic, produce no consistent predictions and no one cares about them ("The earth is flat"). Then we have models that are simple, and yet have very useful predictive qualities. We can measure the Earth if only we assume a few numbers are 'much smaller' than others (Eratosthenes)! An Engineer's First Sin - just assume a certain linear dependence and you can measure something as elusive as time itself (sin(x) ~ x, simple pendulum)! Say a particle can only have two states and can interact with only its nearest neighbors, and poof! You can explain an event as amazing as phase-change (the Ising model)! Assume everything that can be computed can be written down as instructions on a piece of paper, and voila! You come up with fascinating limits on what a computer cannot do (a Turing machine, and the Halting problem)! (And the subsequent hilarity when the Halting problem is outsourced)

But then, the party stops. Here's a bunch of negative reactions about modeling research:

1. It's pointless: the model is extremely complex and the improvement in results are just not worth the effort. The current models are 'close enough' to make any extension seem useless. There's no intellectual pleasure.

2. Talk about a double whammy: modeling seems to have overtaken reality. Many models, especially in bio+engineering areas, are no longer a critical step in deciding anything and their predictive power is never brought into question in any non-trivial problem. Even a model that is used in a critical circumstance is eaten whole by a very roomy engineering safety factor. This is brushed off by saying "Our models will take 20 years to find their use! Look at potential instead of bare reality!"

3. Modeling is also beginning to be used very deviously to demonstrate that a lot of work was done, and therefore the work is worth publishing. Reminds me of a joke that says CFD stands for Colorful Fluid Dynamics. Another related abuse is to put in a section on modeling in an otherwise purely experimental paper. The modeling is supposed to prove that 'what we think is happening is what is actually happening', but in most cases it serves to fill a boilerplate template mandated by some journal.

4. Pauli is once said to have lamented about a paper he was asked to read - 'This is not right. It is not even wrong'. I'm shocked at the number of modeling papers out there which don't even have a hypothesis, or any hint of the model's predictive abilities, usefulness or even a whiff of a reason as to why some poor sod of a grad student wrote 50,000 lines of code. The import of the entire work seems to be "This work was done".

5. A model that has 56 parameters can match any dataset. It's just pushing the problem of 'understanding what is happening' to the level of finding the right parameters. And that level happens to filled with grunt work and boredom.

6. A misconception that better tools lead to better research is rife. Nowhere is this more true than modeling. A supercomputer cluster is trivial to buy - just a few thousand dollars and you have very decent 'computing resources'. I find it especially grating when universities announce with great pomp the opening of a 'High Performance Computing Center'. This is the textbook definition of cargo-cult.

7. Among a host of adapted dick size metrics, a common one is 'full 3D simulation'. A vast majority of engineering modeling consists either of 1D or 2D models, because till the last decade it was impossible to even dream of full 3D simulations. It is debatable where exactly full 3D simulations are necessary - but such trifles don't stop people from merrily performing 3D simulations in the aforementioned High Performance clusters. This unfortunate tendency has resulted in pitiable cases of 5th year PhD students being told that their work will be 'sufficient' only if they re-test their hypothesis (if they were lucky enough to have such intellectual luxuries) with a fancy solver on a cluster, and finding that everything is wrong, and lest they take solace in knowing at least that for a fact, inconsistent.

8. Quite the same complaint applies to 'non-linear', 'parallelizable' and 'scalable'. I think it's like inventing a fine temperature controller for the swimming pool on top of the Titanic. Note well however, that this is a more refined and arguably less criminal form of intellectual fraud. The more dangerous epithets of ill-repute are 'nano-' (in a former birth, 'micro-'), 'bio-', 'ab initio', 'biomimetic' and 'multi-scale'.

9. Continuing on the 3D bashing, even presenting results is extremely hard to standardize. Contours aren't cool. Slices take too much space and are too hard to interpret. But who cares about the results and understanding them? Animations, preferably with lighting and a suavely-accented voiceover, are in. A sectioned 3D artist's impression adds more to the mojo than a graph with sensible axes. These days, in addition to the panegyrics and pedigree and GRE and grades, a graphics design background would be a wise thing for modeling labs to insist on if they are to keep the reams running (or what has become equivalent, surviving).

10. At a deeper level, most models' greatest strength is the audience's ignorance, and this is best seen in interdisciplinary work. If you don't know a lot about something, you cannot honestly be critical about it. Even if you are, you do not have the moral right or standing to express it. In fact, the fundamental paradox of knowledge is that the more you know, the more you realize how little you know, and so your self-measured moral right to critique something diminishes as you learn! Russel once said "The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt". This is a most happy outcome for the fraudulent researcher. In a work on 'Distributed finite element modeling of cancer growth', the solid mechanician can't rightfully criticize the parallel computing algorithm or the biology; the algorithms expert/programmer can't criticize the mechanics or the biology; and the oncologist can't criticize the mechanics or the algorithm.

11. Extending on the previous point, collaboration seems to be similar to Simpson's Paradox in statistics, where each part has one trend (here, honesty) and the whole the opposite trend. This is what makes it possible for a US president to be elected to power even though the total number of votes he has is lesser than that of his rival.

12. In the end, simulations are easy on the pocket. Take 6 computers and 6 desperate grad students, mix well, add a pinch of conference publication hopes, funding threats and sublte emotional blackmail and voila! You have a paper factory all oiled up. Continue for a few years and you'll be light-years ahead of anyone trying to actually do science. If experiments are your thing, there's a slightly modified but equally despicable protocol.

13. Another aspect Petre rightly pointed out: Fudge Factors. We've all heard of Skinner's constant (also called Flannegan's finagling factor), the number which, when multiplied by, divided into, added to, or subtracted from the answer you got, gives you the answer you should have gotten. While it goes about giving people a smile, it's evil cousin lurks deep in simulation codes magically making them coincide with experiments/predicted results. Nearly any work that simulates a non-trivial non-toy phenomenon will have a couple of constants that are either not known, or are heavily disputed. In fact, in some places, the reason simulations are done is because those constants can't be known, and so simulations can give a kind of sample space. But that is quickly lost when the goal is to produce 'good' results. In an example I know well of, that elusive variable was the conduction speed of a cardiac cell. The speed varies with time, depends on location, and changes drastically when a cell is taken outside the heart or if a probe is put in! So right now there's no way to measure it, and so the constant was 'set to appropriately typical values' to ensure the results were 'correct'.

14. This is perhaps the most finicky and least acceptable of objections, but still: when the famous Four-Color problem was finally solved using a computer in 1976, there was a murmur of dissent. Yes, we finally know for sure that only four colors are required to color any map, but no living human knows why it is so. You need a few hundred pages of analysis to reduce the problem to a couple thousand non-trivial base-cases, and then a computer to verify that indeed all these base-cases can be colored with 4 colors. So one more cold fact is known about the world, and there's nothing more to it.  It wouldn't have been very different if the skies opened up and a thunderous unquestionable voice declared "4 is enough!". Similarly, there are some works which simulate flow of some idealized fluid in some idealized turbulent regime, and proudly claim that they have done it using 200,000 CPU hours. This kind of work is neither here nor there - it is too simplistic to be actually experimentally verified, and it is too complicated for anybody to truly understand.

    Every one of these woes carries echoes of being almost there, but not quite. Taking up the task of removing the 'not quite' can be a frightfully unrewarding and disappointing experience.

    To complete the isomorphism, we should look at very complex models that make very useful/impressive predictions. Flight simulators and today's video games come to mind - the complexity of the Physics or Graphics engines used is mind-boggling, and yet, they are so convincingly real that after a few trials, you think the Gravity Gun in Half Life 2 is just another weapon (as opposed to OMFG AWESOME!!!1!!). Astronaut training programs have a necessity to be painfully accurate, and do quite a good job. As we go along, our very definition - that the 'high-end' of modeling is when you can't distinguish between the model and 'reality' - starts to get to us. Is language a model for expressing thought, or is it something on its own? Is your perception of the World, which determines your reaction to everything that happens to you, a model of the world, or is it You?

    --

    [1] The intro Kalidasa gives to his Raghuvamsha is one of the standard self-effacement bids, but he spends so much energy on it and does it so perfectly that it sticks out very conspiciously. Also, ironically it's one of the very few places in all his works that he talks anything about himself at all! (Verses 2-3 in the original (small PDF), a translation)

    Friday, July 10, 2009

    The Dual of Happiness

    A huge number of people I know (me included till recently) are very pained/depressed/unhappy/uninspired by whatever they are doing, and the symptoms are almost exactly the same. Some typical features, collected from a pool of conversations with a lot of people, seem to be -

    1. Life seems to be led more by following constraints than following objectives. It's so algorithmic[1] that sometimes deadlines are almost craved for, because they give the enormous comfort of just doing what you are asked to do within a certain time.

    2. All ambition, at least in the direction you've chosen, seems to have dried up. Ambition and drive which were propelling you forward to achieve more and more seem now to be tortuously dragging you down an unhappy path. You realize that there's no end to where you're going, no closure. There's always something that seems just out of reach, and slogging today appears to help you reach that.

    Doing a PhD? You better work hard if you want a Faculty position. That's the best use of your work and fight so far, the best you can do from your position. MBA? Get into consulting, and slog there so that you can get into Private Equity. Job? Get as much 'countable' experience as possible to that you can get into a good B-School, hopefully in the top 10 in the US. The more you know about the path and as the fog clears up to reveal the very long road ahead, the less amazing/worthy it seems.

    It doesn't stop there. You're an assistant prof? Go fight for tenure and grants. Private Equity? Partner before 35 or bust. Don't you just love your work?

    3. A significantly higher emphasis on relationships, and not just romantic ones. Coupled with this is almost crippling nostalgia and excessive dwelling on some happy moments in the past. There's a quote I recollect from one of Jugu's status messages - 'The world is full of people whose notion of a satisfactory future is, in fact, a return to the idealized past."

    4. Romantic relationships deserve an entire dissertation on their own, but we'll suffice to quote XKCD (who quoted the most excellent WarGames) and say it seems to be a game where the only winning move is to not play, and that choice too results in a loss.

    5. Absolute, sweeping, riveting disinterest in whatever path you chose. Heaven save you if you had good options to choose from - each of those becomes a stinging gnawing 'could-have-been' nightmare.

    6. A very deep realization that almost nothing happens like the conventional wisdom of "1. Set Goal 2. Reach Goal 3. Be happy". Things that do follow this path are usually of absolutely no interest or consequence. Reminds me of one of Zeno's paradoxes, where he argues that a rabbit can never race the tortoise because in order to get past it, the rabbit must first reach the tortoise. But in the time it takes to reach the tortoise, the tortoise would have moved a bit further, and the rabbit must again catch up. Zeno the lucky bastard was dealing with a convergent series, but is everyone as lucky?

    7. A question as simple as 'What do you want to do?' seems impossible to answer. It's all an unholy mix of "I wanted to do this at that time" + "If you do this it will be good/future will be secure/you will prove yourself/it will be a validation of your abilities" + "X, Y and Z chose this path for alpha, beta and gamma reasons which seem to be applicable to you" + "Relax, take your time, you'll eventually start enjoying it".

    8. You see the ultimate paradox of planning - you're trying to direct your actions in a state where you know more (the future), sitting from a state where you know less(the present). If it works out at all, it has to be by chance.

    9. There are always people, very visible people, who are happy in their niches and surging ahead. Their growth seems to be exponential (not just figuratively - the rate of growth is proportional to how far you've gone). So tell me again, what have you done in the past 3 months?

    10. "You should have known". A friend here put it very succinctly - "The only bottleneck is now you". There's no lack of information, no lack of tools, no lack of options, no lack of anything.

    11. Indecision. Pervasive, biting indecision. You're absolutely convinced of one thing in the morning and another thing at night, so much that you don't even know if you're the same person.

    12. Anyone who seems to know what he's doing suddenly becomes a highly sought-after commodity. Advice flows in freely from all directions and towards all directions, and the 'right' thing is the thing that was last most forcefully impressed on your mind.

    13. You're safe as long as you're far away. As long as no one really understands what you're doing (which is extremely likely if you're doing anything remotely non-trivial). "If only they knew of the things that people do here", you think.

    14. There is an anchoring towards over-dramatizing one positive aspect of somebody else's life, to the point of grieving that you don't have it. Money is too trivial an example, but consider something like traveling. You feel a deep sense of lack that your job/life doesn't involve much traveling, and fantasize about how awesome it'd be to see the world. It's normal to feel that in passing, but in this state it seems as if your life is incomplete without it.

    15. There's a tendency to want to live life as if walking backwards. You want to make sure that you make the 'right' choice before making it, even in cases where it's impossible to know.  An abnormal urge to super-optimize everything. A thought-train like this is common - "I'm OK with my job right now. But imagine what I might be missing! What if I instead I was doing this? How do I know I won't like it more than what I am doing?". This is too is a perfectly normal thought in passing, but in this state you feel it right in you, and it's gnawing at you.

    16. You realize the greatest con of organized slavery: The reward for hard work is the opportunity to do more hard work.

    17. Thanks to Nikhil for this one; So far, all your time has gone into proving the existence of potential. Did well in entrance exams? Good, you could do well in engineering. Did well in engineering? You could do well in grad school. Did well in grad school? You could do well in research. Did a great PhD? You could do well in a career in research. Showed promise as a junior researcher? You could do well in middle management. Every single thing you do is a (likely nonconstructive) existence proof.

    This happy state of affairs seems to be rather well approximated by the idea of a Quarter Life crisis, but everyone has their own flavor. The solution to all this is? I have no freaking clue.

    But about everything else: the most exalted and most venerable Raja Rao once said to an overzealous ED class in glorious Guntur Gult: 'myaake dengevaadu okkadu unte toke ettevadu okkadu untaadu'. (The glory is all but lost in translation, but still: 'If there's someone ready to fuck a goat, there'll someone else ready to lift its tail. [So chill, dude]').

    You know you're living an eventful life when you take solace in Raja Rao's expletives :-)

    Update (Nov 7): A very nice article in the New York times, The Referendum.
    --

    [1] and Title: A 'dual' to an optmization problem is looking at the problem from the point-of-view of a person on the other end of the transaction. For example, if you're minimizing the cost for some buyer in some given cirumstance, the dual of that problem is maximizing the price for the seller in the same circumstance. The constraints of the dual correspond to the variables you can play with in the original, 'primal' problem.

    About constraints and objectives, there are two very broad divisions of optimization algorithms: the first kind, which slide along constraints and check if they are improving the value of objective. Constraints are very important for this kind, because they can greatly simplify the search. The very famous Simplex algorithm is an example of this kind. I had written a small, general-purpose article about the history of this method a long time ago, and in case you're interested, here it is (Page 26).

    The second kind of algorithms care more about the objective function first, and use that as a guide to move around and try to stay within the constraints. Karmarkar's interior point algorithm is of this kind.

    So when I say 'algorithmic', I really mean algorithmic :-)

    Thursday, February 05, 2009

    Goodbye Dilip

    Prof. Veeraraghavan passed away yesterday. He is the single most broad-minded, sympathetic person that I have ever come across in my life. He inspired hundreds of students to be better human beings and taught us what sincerity, honesty and caring means. I don't know how to write about a person who every single time I met him made me ponder for hours on the kindness of his words. May he rest in peace.

    (There's a wiki of memories of Dilip. It's a very nice idea because everyone has so much to say about him, and I really hope it grows.)

    Tuesday, January 13, 2009

    Eulerian Ornithology

    Nikhil, totally excited: "Macha, you should have been there at Tressider this afty. Babes, babes and more babes everywhere da! The babe density was so high that if you saw a babe at a location, you didn't need to move your eyes to follow her. You could be certain that an equally hot babe would be at the same spot in the next instant!"

    :-)

    --
    When you're analyzing motion of a fluid, you have two approaches. The first, called the Eulerian, is to look at one small region in space and see what happens in time at that region. You'd do this if, say, you were measuring the rate of flow of a river at some place.

    The second option is to tag a little drop of fluid and follow the drop as it moves. You could do this by putting a small drop of ink that doesn't mix with the flow, for example. You'd do this if you were interested in designing a wing so that the flow over it is smooth.

    One of the first things that made me totally fall in love with Feynman many years ago was this example of his that brought out the difference: Consider a liquid going around with uniform velocity in a circular tube with a circular cross section. At any one point in the tube, the velocity of the fluid would not change in time. But if you followed a single particle of water, it's velocity would change direction constantly!

    If I ever teach a class on Fluids, I'll give the babe example before I discuss this topic :-)

    Sunday, November 30, 2008

    a = a + b; b = a - b; a = a - b;

    “Macha the dal in the microwave is done. The palak in the bowl on the table seems thawed enough, most of the ice has melted. Take a third bowl, put the dal in it, put the palak in the microwave bowl, and set it for 3 min.”

    “Cha, if we could XOR swap the dal and palak we wouldn't need a third bowl da.”

    As Charles ‘Peanuts’ Schulz said, "Happiness is a warm Nai." (and a hungry Nikhil and TS).
    --

    The title is the poor man’s swap program. It interchanges the values of ‘a’ and ‘b’ without using a third variable. The XOR swap does exactly the same thing, but the incisively analytical reader would of course prefer the XOR swap because it sounds cooler :-)

    :-)