Hot answers tagged

5

If I understand you correctly, here's an example in Python. Any other programming language should be able to do something similar: def search(path): if len(path) == 5: if sum(path) == 0: print path else: search(path+[1]) search(path+[0]) search(path+[-1]) Just invoke it with an empty array: >> ...


1

A tree and a lattice are the same thing and are most often used interchangeably. Both a tree and a lattice can either be recombining (an up move followed by a down move is equal in value to a down move followed by an up move) or not recombining. A non-recombining lattice is sometimes considered a bush.


1

you could do it that way. Or you could take a time-dependent drift and discretize $$ d \log S_t = (r(t) - 0.5\sigma^2) dt + \sigma dW_t.$$ $r(t)$ is chosen to be constant across each step so that the df is correct across each step. Take $W_{t+\Delta t} - W_t$ to be $\sqrt{3 \Delta t} X$ with $X \in \{-1,0,1\}.$ There are many ways to do a trinomial tree. ...


1

On one side there's a lot like A lattice Boltzmann model for the Fokker–Planck equation, on the other get a look at any PDE pricing method under diffusions. Also this is more directly on pricing.


1

To convert an index to base 3 (actually to an array with the base 3 digits, each one selecting a move up/mid/down) you only need to alternate a modulo-3 (remainder) operator and integer division by 3. Or were you asking for something else?


Only top voted, non community-wiki answers of a minimum length are eligible