## Archive for March, 2008

### Columbia Online Learning Information Session

Mar 22, 2008 in Columbia

Upcoming Online Information Sessions:
JoinÂ us to find out general information about Columbia Video Network. Sessions are held each week. Sign up for one of the sessions below.
Monday, June 2, 2008, 2:00 PM EDT. Click here to register for the Monday session.

Wednesday, June 4, 2008, 2:00 PM EDT. Click here to register for the Wednesday session.

### Tips, Tricks and Traps

Mar 16, 2008 in Mathematica

Tips, Tricks and TrapsÂ  Another Mathematica talk I gave covering some of my favorite tips, tricks and traps.

### Binomial Trees in Mathematica

Mar 16, 2008 in Derivatives, Mathematica

In generating a binomial tree, we have to first generate a tree of stock prices.Â  Using the centered tree approach of Cox-Rubenstein-Ross, we define Si,j =S0,0 uj di-j

If we want to generate a tree that looks like the one below,

 Â Â Â Â 100.1 Â Â Â Â 100.08 Â Â Â Â 100.06 Â 100.06 Â Â 100.04 Â 100.04 Â Â 100.02 Â 100.02 Â 100.02 100 Â 100 Â 100 Â Â 99.98 Â 99.98 Â 99.98 Â Â 99.96 Â 99.96 Â Â Â Â 99.94 Â 99.94 Â Â Â Â 99.92 Â Â Â Â Â Â 99.9

We can use code such as

StockTree=Table[S[i,j],{i,0,n},{j,i,0,-1}];Â Show[Graphics[{Text[“Stock Price”,{2,2}],Table[Text[Reverse[StockTreePi\[RightDoubleBracket]],{2,2-i}],{i,1,n+1}]}]]

However there is a problem when we want to evaluate the StockTree for calculation of puts or calls.Â  In standard form, our stock tree looks like this:

{{100},{100.02,99.98},{100.04,100.,99.96},{100.06,100.02,99.98,99.94},{100.08,100.04,100.,99.96,99.92},{100.1,100.06,100.02,99.98,99.94,99.9}}

Suppose we want to calculate a call tree, where we want Max[S-K,0].Â

The Max function won’t map across the list.Â

For a simpler example, consider the list created as

myTable = Table[Table[i,{i,1,j}],{j,1,5}]{{1},{1,2},{1,2,3},{1,2,3,4},{1,2,3,4,5}}

If you try taking Max[myTable-3,0], you will just get the value of 2 (from the last element 5), when what we really wanted was to have the Max function applied across all elements.Â

We could flatten and restructure the list, applying Max element by element, but it seems there should be a better way. The reason you can’t get the result you wantÂ is because the built in Max function does not have the Listable attribute.Â  To see the attributes, just type Attributes[Max].Â  The result is:

Not that it’s a good idea to change the attributes of built in functions, but you can type Attributes[Max]={Listable}.Â  Now look what happens when you type Max[myTable]:Â  you get the desired result of {{0},{0,0},{0,0,0},{0,0,0,1},{0,0,0,1,2}}

Now, we can go ahead and define our call and put functions CallTree = Max[StockTree-K,0] whose result is

{{0},{0.020002,0},{0.040008,0.,0},{0.060018,0.020002,0,0},{0.080032,0.040008,0,0,0},{0.10005,0.060018,0.020002,0,0,0}} and so forth.

### Ctrl-Alt-End

Mar 16, 2008 in Tech Tricks

Ever want to do the equivalent of Ctrl-Alt-Delete to stop a process on a server that you have remote desktopped into?Â  The equivalent is Ctrl-Alt-End.

Ever lose your desktop in Windows and faced with the blue screen of death?Â  This just happened to me after I had to kill some non responsive processes and even after restarting twice, couldn’t see the desktop.Â  Ctrl-Alt-Delete brought up the windows task manager, and from there you can choose File/New Task (run).Â  Type cmd in the window that appears, and in the black screen DOS command window that appears, type explorer.Â  This will restore your desktop.

### Quant Interview Questions

Mar 06, 2008 in Interview Questions

Lots of great interview questions and tips on quantlifeÂ here

### A few more interview questions

Mar 06, 2008 in Interview Questions

I have been asked this more than once, it seems to be a perennial favorite!Â  In one sentence, tell me what an outer join is?Â  Now how about an inner join?Â  When would you use an outer join vs. an inner join?

You are rolling a fair six-sided die.Â  You will receive a reward equal to the roll (that is, if a 3 is rolled you get \$3 etc.).Â  You can accept the result of the first roll and stop, or you can reject it and roll again, taking that roll as your win.Â  What is the fair value of this game?Â  What if you roll a third time, what is the pattern?Â  Can you use the answer from the first two rolls to answer this?

Â You have a friend who has two children.Â  You do not have any other information regarding their ages or gender.Â  You go to his house and ring the doorbell.Â  A little boy answers (you can assume that this is his son.)Â  What is the probability that the other child is a girl?

Is it possible to have a bond with convexity of zero?

How would you hedge default risk?