What Motivates the Doctor?

The Plague by Albert Camus tells the story of Rieux, who serves as presiding doctor over a small north-African town as it is struck by a deadly plague.  The plague “shuffles the cards,” as one townsperson puts it; wealth, status and occupation spare no one.  As the town is quarantined and daily life grinds to a halt, Rieux and his closest friends are forced to reevaluate their understanding of their position and purpose within their community and on this earth.  Addressing his friend Rambert, a journalist who got trapped in the town by mistake, Rieux says:

‘But I have to tell you this: this whole thing is not about heroism. It’s about decency. It may seem a ridiculous idea, but the only way to fight the plague is with decency.’

‘What is decency?’ Rambert asked, suddenly serious.

‘In general, I can’t say, but in my case I know that it consists in doing my job.’

The plague of Florence (1348)

The plague of Florence (1348) as described in Bocaccio’s Decameron

Continue reading

Computational Finance

Can the markets be cracked? “Probably not,” said my Dad a million times – last summer, I tried it anyway. I wrote a computer program to download and organize financial data, and test various trading strategies.

Beginning with a generalized trading strategy, the program would generate thousands of variations and historically back-test each one. The best-performing algorithms and their results were stored. The results were promising: my program found trading algorithms which outperformed the S&P 500 Index for the past 30 years running.

Here’s an example of the functionality. Begin with a simple trading structure: e.g. if a stock goes down by x percent in the past y days, then buy it and hold for days (actual algorithms were more complicated, and had about ten parameters). Wind the clock back 30 years, throw in the 500 stocks of the S&P, and iterate through time, swapping portfolio allocation like lightning according to the pattern of choice — and rinse and repeat for every permutation of our parameter set we could desire. Each 30-year iteration took about a second. I used to let it run overnight.

My Program

The visual part of my program helped me search for promising patterns.

Continue reading

Currency Manipulation Blues

So what’s the deal with “currency manipulation” anyway? Recent political debate has warned against the dastardly dangers of China’s “unfair trade practices” and demanded that heavy import duties be slapped on Chinese goods. What’s up, what’s down; what’s good, what’s evil?

It’s true that China has significantly and artificially debased the value of its currency, the RenMinBi (denominated in yuan), stocking up on massive amounts of foreign-exchange reserves (usually US Dollars and US  Treasures) and flooding the market with ever-cheapening yuan. It’s also clear that China has done so with the aim of increasing its exports: when currency is less valuable, each unit of foreign currency purchases more units of domestic currency, exports become “cheaper” for foreigners and more widely bought, and domestic manufacturing jobs increase. Or so the logic goes.

Continue reading

Man vs. Machine

In 1997 IBM’s supercomputer Deep Blue beat world chess champion Garry Kasparov, 3½ games to 2½, in a 6-game series.  This quintessential triumph of machine over man is often called the most spectacular event in chess history.  As one of chess’s greatest minds fell to a network of circuits and transistors, the very line between brain and computer was blurred.  And one could only imagine that, in the future, this distinction might disappear completely.

Basal Ganglia Diagram

Basal Ganglia Diagram

But we’re certainly not there yet.  The basal ganglia, a group of nuclei located in the vertebrate forebrain, work in concert to regulate a remarkable variety of important functions, from eye movement and procedural learning to higher-order functions like emotion and cognition—more than Deep Blue could ever achieve.  Imbalance of neurotransmitter levels within these pathways leads to motor disorders like Parkinson’s and Huntington’s, and is even associated with neuropsychiatric disorders like schizophrenia.  The importance of this group of nuclei is far-reaching, and demonstrates that, despite what sensationalized chess matches may suggest, the brain is still the world’s most powerful computer.

I decided to give the brain a run for its money, however, and built a C++ program to model the basal ganglia. Continue reading


They say deep down, everything’s simple – and Mr. Joseph Fourier would probably have agreed. The Discrete Fourier Transform is mathematical operation that takes a complex wave and decomposes it into a combination of many simple sine and cosine waves. These simple waves, when added back up, form something very close to the original wave. In fact, if enough simple waves are used, any complex wave may be nearly perfectly decomposed and recreated using a Fourier transform.

The Fourier transform has many applications in science and engineering. In one application, natural language recognition, DFTs are performed on human speech; different vowels and consonants can be picked out by determining, given a complex wave, which of these simpler sub-waves contribute more to the total and which contribute less (these together determine the “flavor” of the wave). The ever-mentioned “spectrum” is nothing more than a DFT applied to sound; on the x-axis is graphed which simple wave we’re talking about (in terms of frequency) and on the y-axis is graphed how much of that simple wave there is in the complex wave (in terms of amplitude). Spectrums are an interesting way to “peek inside” a complex pattern and see what it’s really made of.

What would a Brother Diamond do? In pursuit of hidden cyclical patterns, I wrote an FFT (Fast Fourier Transform, more on this later) algorithm and applied it to stock data. Here’s Microsoft (MSFT)’s price over the past year…

msft price

Continue reading

The Other Brothers

This article is part of a series on Dostoevsky’s Great Works. See also:

  1. The Brothers Karamazov: The Other Brothers
  2. Crime and Punishment: Flesh and Bronze
  3. The Idiot: Give and Take

“Man prefers peace, and even death, to freedom of choice in the knowledge of good and evil.”

The Brothers Karamazov tells the story (many stories, actually) of three brothers, each very different, as they adventure through trial, love, and every emotion on earth. Dmitri is the oldest: he’s a recently retired soldier, rash, impetuous, and driven by emotional impulse; Ivan is the middle brother: he’s cynical, intellectual, and probably depressed, and hides an enormous well of philosophical wonder; Alyosha is the youngest: he’s bright-eyed, optimistic, and highly religious with unlimited faith. Ivan struggles through an existentialist “Rebellion”, denying the order of the universe (or, rather, denying willingness to reconcile with its lack of order); eventually, crushed by the criminal trial of his older brother, Ivan suffers taunting hallucinations and mental illness and eventually loses his mind.

I claim that Ivan himself is the site of a battle between the Devil and God. His “brain fever” is purposefully ambiguous: are his hallucinations the result of physical illness, or is the illness merely a convenient explanation for goings-on that are much deeper and more mystical? I’ll note here that his “illness”, I believe, had already begun back in Pro and Contra, when he sits down with Alyosha for “Rebellion” and “The Grand Inquisitor”…

And the Devil and God are both mighty-convincing! Surprisingly so: it’s much deeper than a trivial case of good vs. evil. Regarding Ivan’s desire to testify for his brother, the Devil taunts, “You are going to perform an act of heroic virtue, and you don’t believe in virtue; that’s what tortures you and makes you angry, that’s why you are so vindictive.” The Devil insists that only cowardice holds Ivan from betrayal; that only cowardice confines him to his facade of sacrificial virtue. These evil thoughts overwhelm Ivan’s mind: “Conscience! What is conscience?” he asks Alyosha. “I make it up for myself. Why am I tormented by it? From habit. From the universal habit of mankind for seven thousand years.”

God, in the form of Alyosha, teaches Ivan to love unconditionally. “Alyosha could not help crying, looking frankly at his brother. ‘Never mind him, anyway,’ ” urges Alyosha regarding Ivan’s hallucination; “ ‘have done with him and forget him. And let him take with him all that you curse now, and never come back!’” Later, as Alyosha thinks to himself: “ ‘Yes, if Smerdyakov is dead, no one will believe Ivan’s evidence; but he will go and give it.’ Alyosha smiled softly. ‘God will conquer!’ ”

The conflict reaches its peak around Ivan’s decision whether to testify for Dmitri’s innocence. At the end – in the truest tragedy of all – Ivan takes the side of the good, and it fails him. Ivan tries to testify for Dmitri, but, paralyzed by the decision, utters only an incoherent mess, consummating his insanity, and collapsing on the scene; Mitya gets convicted anyway, and is sent to hard labor in Siberia. Ivan gets neither his sanity nor an acquitted brother. At the end of the day, the Devil was right all along!

Alyosha offers hope at the end but it’s up to you whether you buy it.

And finally, Dmitri, in prison: “I’m innocent, but I’ve got to go to Siberia. I accept it. It’s all come to me here, here, within these peeling walls. There are numbers of them there, hundreds of them underground, with hammers in their hands. Oh, yes, we shall be in chains and there will be no freedom, but then, in our great sorrow, we shall rise again to joy, without which man cannot live nor God exist, for God gives joy: it’s His privilege—a grand one. Ah, man should be dissolved in prayer! What should I be underground there without God? And then we men underground will sing from the bowels of the earth a glorious hymn to God, with Whom is joy. Hail to God and His joy!”

What a great book.