Anecdotes from school: Divisibility test for Seven

This is a new series on this blog, called Anecdotes from school. I realize I’ve had so many awesome anecdotes in school that I should tell you people about it. Of course I won’t write about the incidents when I beat up people or got beaten up by people (both were common). Even leaving them out, school was quite an awesome time so I think I should write about it.

One fine morning when I was in 9th standard, I arrived at school to find the rest of my class raving over this little guy called Ramu. He had apparently made some major mathematical breakthrough, and the school had called the Deccan Herrald to interview this prodigy. He is the next Ramanujan, people claimed (no, Ramu wasn’t short for Ramanujan). Efforts were made by all parties to hurt my class topper ego – what is the use of being a topper if you can’t come up with breakthrough discoveries, they said.

A few days back, we had studied divisibiility tests. Powers of two were simple, as were 5, and 3 and 9. 11 was also quite simple, and that left only 7 among the “simple primes” for which there didn’t exist an elegant divisibility test. “This is an unsolved problem”, Matki, our maths teacher, had declared. “Any one who can solve this is sure to win a Nobel Prize” (evidently she didn’t know that no Nobel is given out for Math. Of course, us 13-14yearolds also had no clue about such finer details.

So Ramu had woken up one morning with a divisibility test for seven. As I mentioned earlier, by the time I reached, the entire class had been convinced. I’m not sure if Matki had heard about it yet. It was a weird test, and I must admit I don’t remember it. It was extremely inelegant, with different operations to be done with different digits of the number. If it were elegant, I had reasoned, this problem wouldn’t have been unsolved for so long, I had reasoned. So inelegance would not really take away any greatness from the method.So I asked Ramu to demonstrate it to me.

He wrote down a few numbers on the blackboard – all known multiples of seven. Actually he picked only powers of seven (49,343 and 2401). The reason he did this (picking powers) is unclear. So he takes the numbers, puts his magical algorithm on it, and there it is. Done. Hence proved. QED.

Of course this was too much for my class topper ego to take, and I spent the rest of the day trying to find holes in this argument. In the meantime Matki and the other senior maths teachers in school had learnt about this, and had gotten convinced of the greatness of Ramu and his algorithm. The team from Deccan Herald was supposed to arrive at 4 o’clock, we were informed.

It was sometime in the afternoon. Maybe during the history lesson. My ego had been hurt so much that I obviously didn’t care about the lesson. All I cared for was to poke holes in Ramu’s algorithm. I decided to stress-test it. I picked 8. And ran the “divisibility test for seven”. The algorithm said “divisible”. I picked 9. Again the algorithm said “divisible”. 1. Divisible by 7. 2. Divisible by 7.

I had confronted Ramu during the lunch break regarding my “experiments” with his algorithm. “You obviously know that 8 is not divisible by 7. Why do you even bother running the test on that?” He countered. “Errrr.. Isn’t that the point of the divisibility test?”, I asked. I had already started to become unpopular in class. I then started picking random large numbers whose divisibility by 7 I had no clue about. According to Ramu’s algorithm, all were supposed ot be divisible by 7.

Deccan Herald was hurriedly contacted again, and asked not to come. I don’t know how Matki or any of the other maths teachers had reacted to this. I was “boycotted” by the class for the next one week for destroying the career of a budding mathematician. Ramu, however, wasn’t finished. A week later, he came up with an algorithm for trisecting an angle using only a straight edge and a compass.

Introducing: NED Talks

I suppose a number of you have heard of TED Talks (ted.com). You might have seen it in the news recently, for it is going to come to Mysore sometime later this year. TED talks are available online (on the ted website), and are in general extremely informative and entertaining.

When TED can have talks, can NED be far behind? So I, along with Kodhi, hereby invite you to the first of the series of NED talks. The beauty of NED talks is that nothing is known yet. So far we’ve been putting NED to figure out what we are going to have as part of those talks. However, wee are confident that we won’t put NED to organize the talks themselves.

So here are a few salient features. You might notice that nothing is concrete yet, heck nothing is even the steel framework yet. I request you to add your own concrete to this, and put in your ideas.

  • The first of the series of NED talks is likely to be held in Bangalore in October 2009. I have picked the date randomly, and is subject to change.
  • The first of the series will be a day-long event. However, if registrations exceed our expectations, the event might last a whole weekend.
  • We have no clue what is going to be there as part of these talks. We know that it is going to be a bunch of mango people (aam junta for the uninitiated) who will be talking, but we dont’ know what they are going to be talking about. We don’t even know who are the people who are going to be talking, though I’m sure I’m going to be one of them.
  • If you have any bright ideas as to what we can do at the NED talks, please let us know.
  • NED is not rich enough to put talks on its own website, hence the videos will be put up on youtube. However, we cannot promise the same quality that the TED videos.
  • Please note that NED talks are only loosely inspired by TED talks, and has nothing to do with the latter. I also wish to clarify that NED talks are not a spoof of TED talks.
  • At the risk of repeating myself – if you have any bright ideas as to what can be done at the NED talks, plis to be cantributing.
  • Oh and at the risk of repeating myself again – we are really serious about organizxing the NED talks. And we promise that we won’t put NED for NED talks.

Intellectual Property

A blog post earlier this month on Econlog finished off with a very strong quote by Friedrich Hayek:

One of the forms of private property that people cherish most is their ideas. If you convince them that their ideas are wrong, you have caused them to suffer a capital loss.

I ended up liking it so much that I added it to my work email signature. Thinking about it further, why is it that some people are more open to debate than others? Why do some people admit to their mistakes easily while others are dogmatic about them? Why do some people simply refuse to discuss their ideas with other people? I think Hayek’s observation offers a clue.

Let us consider two people – Mr. Brown and Mr. Green. Mr. Brown believes in diversification, and his investments are spread across several financial instruments, belonging to different categories, with a relatively small amount of money in each of them. For purposes of this analogy, let us assume that no two instruments in his portfolio are strongly correlated with each other (what is strong correlation? I don’t know. I can’t put a number on it. But I suppose you get the drift)

Mr. Green on the other hand has chosen a few instruments and has put a large amount of money on each of them. It is just to do with his investment philosophy, which we shall not go into, as this is just an analogy.

Let us suppose that both Mr. Brown and Mr. Green held Satyam stock on 6th January 2009. They were both invested in Satyam according to their respective philosophies – and the weightage of Satyam in their respective portfolios was also in line with their philosophies. The next day, 7th of January, the Satyam fraud came out. The stock crashed to a tenth of its value. Almost went to zero. How would our friends react to this situation?

Mr. Green obviously doesn’t like it. A large part of his investments has been wiped out. He has become a significantly poorer man. For a while he will be in denial about this. He will refuse to accept that such a thing could happen to one of his chosen stocks. He will try to convince himself that this fall (a 90% fall, no less) is transient, and the stock will go back to where it once was. As days go by, he realizes that his investments have been lost for ever. He is significantly poorer.

Mr. Brown will also be disappointed by the fall – after all, he too has lost money in the fall. However, his disappointment is mitigated by the fact that the loss is small compared to his portfolio. There have been other stocks in his portfolio which have been doing well, and their performance will probably absorb the Satyam losses. Some of the stocks in his portfolio may also be fundamentally negatively correlated with Satyam, which means they will now gain. There is also the possibility that the Satyam fall has opened up some new possible areas of investment for Mr. Brown, and he might put money into them. It is much easier for Mr. Brown to accept the fall of Satyam compared to Mr. Green.

So you replace stocks by ideas, and I suppose you konw what I am gettting at. The degree of openness that people show with respect to an idea they have varies inversely with the share of this particular idea in their “idea portfolio”. The smaller the proportion of this idea, the lesser will be the “capital cost” of their losing the idea. And hence, they will be more open to debate, to discussion, to letting someone critically examine their ideas. If the proportion of this particular idea in their overall portfolio is large, there will obviously be resistancce.

A corrolary of this is that when someone possesses a small number of ideas they are more likely to be dogmatic about them (I am using the indefinitive “more likely” here because even when you have a small number of securities in your portfolio, your exposure to some of them will be really small and so you’ll be less unwilling to lose them. Though I must point out that people with small ideas portfolios become so used to madly defending the big ideas in the portfolio that they start adopting the same tactic for the smaller ideas in their portfolio and become dogmatic about them – which is irrational).

I just hope I didn’t cause you a capital loss by writing this. For me, on the other hand, this was a bonus stock.

Stud and Fighter Instructions

My apologies for the third S&F post in four days. However, this blog represents an impression of the flow of thought through my head, and if I try to time my thoughts to suit readers’ interests and variety, I’m afraid I may not be doing a very good job.

I came across this funda in one of the “sub-plots” of Richard Dawkins’s The God Delusion, which I finished reading two days back. Actually, there is another post about the main plot of that book that I want to write, but I suppose I’ll write that some other day, maybe over this weekend. So Dawkins, in some part of the book talks about two different ways of giving instructions. And thinking about it, I think it can be fit into the stud and fighter theory.

I must admit I’ve forgotten what Dawkins used this argument for, but he talks about how a carpenter teaches his apprentice. According to Dawkins, the carpenter gives instructions such as “drive the nail into the wood until the head is firmly embedded” and contrasts it to instructions which say “hold the nail in your left hand and hit it on the head with a hammer held in the right hand exactly ten times”. By giving instructions in the former way, Dawkins argues, there is less chance of the apprentice making a mistake. However, in case the apprentice does err, it is likely to be a significantly large error. On the other hand, with the latter kind of instructions, chance of error is higher but errors are likely to be smaller.

A set of “stud instructions” typically tell the recipient “what to do”. It is typically not too specific, and lists out a series of fairly unambiguous steps. The way in which each of these smaller steps is to be accomplished is left to the recipient of the instructions. Hence, given that each instruction is fairly clear and unambiguous, it is unlikely that the recipient of the instructions will implement any of these instructions imperfectly. What is more likely is that he goes completely wrong on one step, maybe completely missing it or horribly misunderstanding it.

“Fighter instructions”, on the other hand, go deep into the details and tell the recipient not only what to do but also how to do what to do. These instructions will go down to much finer detail than stud instructions, and leave nothing to the reasoning of the recipient. Obviously the number of steps detailed here to do a particular piece of work will be significantly larger than the number of steps that a set of stud instructions. Now, the probability that the recipient of these instructions is likely to make a mistake is much larger, though the damage done will be much smaller, since the error would only be in a small part of the process.

Dawkins went on to give a better example than the carpenter one – consider an origami model of a boat on one hand, and a drawing of a boat on the other. Origami gives a set of precise and discrete instructions. Drawing is as good as a set of “continuous instructions”. Dawkins talks about experiments where kids are made to play a version of “chinese whispers” using the origami and the drawing. I won’t go into the details here but the argument is that the stud instructions are much easier to pass on, and the probability of the tenth kid in line producing a correct model is really high – while in case of a drawing, there is a small distortion at each and every step, so each final model is flawed.

Stud and fighter instructions have their own set of advantages and disadvantages. Fighter instructions require much more supervision than do stud instructions. Stud instructions enable the recipient to bring in his own studness into the process and possibly optimize one or more of the sub-processes. Fighter instruction sets are so-finegrained that it is impossible for the recipient to innovate or optimize in every way. To receive a set of stud instructions, the recipient may need to have certain prior domain knowledge, or a certain level of intelligence. This is much more relaxed in case of fighter instructions.

I personally don’t like supervising people and hence prefer to give out stud instructions whenever I need to get some work done. However, there was one recent case where I was forced to do the opposite. There was this IT guy at my company on contract and I was supposed to get a piece of code written from him before his contract expired. Given the short time lines in question, and given that he didn’t have too much of a clue of the big picture, I was forced to act micro and give him a set of fighter instructions. He has ended up doing precisely what I asked him to do, the only problem being that he has  written code in an extremely inflexible and non-scalable manner and I might have to duplicate his effort since this bit now needs generalization.

I have noticed that a large majority of people, when they have to give out instructions spell it out in the fighter manner. With a large number of micro steps rather than a small number of bigger steps. And until the recipient of the instructions has got enough fundaes to consolidate the set of micro-instructions he has received into a natural set of bigger chunks, it is unlikely that he will either be very efficient or that he will produce stuff that will be flexible. It might also be the case that a large number of people don’t want to let go of “control” and are hence loathe to give out stud instructions.

In the general case, however, my recommendation would be to give stud instructions, but have a set of fighter instructions ready in case the recipient of the instructionss wants things to be more specific.

Preliminary reading on studs and fighters theory:

Studs and Fighters

Extending the studs and fighters theory

How do i describe my job?

One of the “problems” with my job, if I can describe this as one, is that it’s tough to explain my job to a layman. There are multiple levels of disconnects here, and multiple “pitfalls”, if I can call them that. So when someone asks me about my work, it gets tough indeed to describe to any degree of accuracy while at the same time being concise, and at the same time talking in Kannada.

I am a quant at a hedge fund.

My work involves coming up with trading strategies, and then developing them to a level where I can have the ultimate fighter – a computer – to trade using these strategies. Then, I will need to figure out how the computer is going to implement these strategies and this part involves some heavy engineering work. And finally I code. Ok now I haven’t been accurately able to describe in one paragraph, writing in English, about my job. How do you expect me to describe it to the layman speaking in Kannada?

Coding is a part of my job, but I’m not a coder.

I deal with financial products – equities and equity derivatives. But I’m strictly not a finance guy – as far as I’m concerned, each security is just a time series. A time series on which I can trade and make money. In fact, apart from my short stint selling interest rates swaps in London, I haven’t really done any finance. My entire view of the markets is based on my idea that a security is just a tradeable time series. I think I should do a separate post on that. Anyways, I’m not strictly a finance guy also.

One of my degrees is an MBA. A PGDM to be precise, from IIMB. But I’m not a manager also. I don’t manage people apart from myself.  I’m not sure I’ll find that interesting either – I sometimes think managing is too fighter a job for me.

And so on.

And then, I work for a hedge fund. Most people don’e have a clue what a hedge fund is. I sometimes make an approximation and tell them I work for a mutual fund. And immediately I get bombarded with questions like my opinion on whether the markets will go up or down, and about how long the recession is going to last. And then there are those who start telling their sob stories about their investments in the markets when the Sensex was at 20,000 and about how markets can’t be trusted any more.

Another level of contradiction is that I’m based in Gurgaon. All finance companies are supposed to be in Bombay, right? Surely, given that I’m in Gurgaon, I must be doing some back office kind of work?

Last night my uncle was filling up some arranged marriage exchange registration form for me. And he asked me to describe my job in a short phrase. I immediately came up with “trader” and that got quickly shot down since that would give the image of a lala sitting behind huge weighing scales. Next I tried “financial trader” and “quantitative trader”. No go.

Then I wanted the simple “quant”. My highly stud uncle himself had trouble exactly figuring that out, so fat chance anyone would appreciate that. So out again. I relaxed constraints a bit and said “hedge fund professional”. But most people wouldn’t understand “hedge fund”. “mutual fund” was no go for a written form. “quantitative analyst” was considered too country by my uncle. He then asked me my designation. “Associate” doesn’t mean anything, he said and shot that down too.

Sometimes I wonder if I’ve unnecessarily complicated life for myself by choosing the path that I’ve chosen. If I were working for some software company I could’ve just written “software” over there and all would’ve been fine. The whole world would’ve understood, or at least claimed to have understood. Or even better, if I were living abroad, I wouldn’t have even been required to say that much. I’d’ve been just qualified as a “foreign huduga”, with most people not even caring for which city I was in.

For the record, my listing application records my profession as “financial services professional”, as country as it sounds. This was the only middle ground where my uncle and I didn’t disagree. And in it went. It increasingly looks like I’ll have to put fundaes to Cesares about why the stock markets have gone down in the last one year in order for them to allow their daughters to marry me. I have half a mind to start describing Ito’s lemma the next time someone asks me where the markets are headed. I’ll probably start off describing to them a random walk. And say that it’s a drunkard’s walk. And perhaps use that to change the topic. I think I might need to start practicing this. In Kannada.

I’m a quant at a hedge fund.

Process

A couple of days back, I was debugging some code. And yes, for those of you who didn’t know, coding is a part of my job. I used to have this theory that whatever job you take, there is some part of it that is going to be boring. Or to put it in the immortal words of a brilliant co-intern at JP Morgan “chootiya kaam”. And in my job, the chootiya part of the kaam is coding. That doesn’t mean that I’m not enjoying it, though. In fact, for the first time in nine years (note that this takes me to a time before I’d started my BTech in Computer Science) I’m enjoying coding.

Coming back, I was debugging my code yesterday. It was one of those impossible bugs. One of those cases where you had no clue why things were going wrong. So I started off by looking at the log files. All clean, and no bugs located. While I was going through them, I got this idea that the strategy sheet might offer some clue as to why things aren’t doing well. Half the problem got diagnosed when I was looking at the strategy sheet. Some problem with cash management.

And when I thought looking at the trades might help. The bug was presently discovered. And then it hit me – that I’d unwittingly followed what seems like a “process”. Everything that I did had been guided by insight and instinct. Yet, the steps that I followed – 1. look at the logs; 2. look at the strategy sheet ; 3. look at the trades – seemed so much a preset process. It seemed to be like one of those things that I’d just ended up reading in some manual and following.

I realize that most “standard processes” that are followed by  various people in various places are stuff that were initially not meant to be processes. They were just an imprint of somone’s train of insights. It was as if someone had a series of insights that led to a solution to whta might have been a difficult problem. And then, he realized that this kind of a process could be followed to deal with all such similar problems. And so he wrote down the process in a book and taught a set of people to implement them. The field thus got “fighterized“.

The argument I’m trying to make here is that a large number of so-called “standard processes” are just an imprint of someone’s insight. They just happened to get into place because the inventor noticed this pattern in a bunch of things that he was doing. They need not be the best way of doing what is supposed to be done. Maybe there isn’t even a single best way of doing it that might work every time.

People who are likely to have worked on processes later in their life cycle are likely to have been people who are process-oriented themselves, and given how these kind of people work, it would have been likely that they would have resisted changes that could make the process worse in the short term. They are more likely to have been incremental in their approach. With a succession of such people working on improving the process, the process of refining the process would’ve ended up taking a hill-climbing algorithm and is likely to have ended up in a local maximum.

Once again, the large changes to the process would’ve happened when someone who was willing to take a large step backward worked on them, and it is again likely that such a person would be driven more by insight rather than by process.

My hypothesis is that most processes are likely to have been largely defined by people who are themselves not very process-oriented, and who thus will expect a certain level of insight and discretion on the part of the person implementing the process. And one needs to keep this in mind while following processes. That it would be good if one were to take a critical view of every process being used, and not be afraid to take a backward step or two in process development in order to achieve large-scale improvements.