Mathematical Finance Programming In Ti-basic Article Index for
Mathematical
Website Links For
Mathematical
 

Information About

Mathematical Finance Programming In Ti-basic




Quantitative (mathematical) Finance is based on Stochastic Calculus , and more specifically on the Ito's Lemma .


TI-BASIC PROGRAMS



Ito's lemma

Let's begin defining a stochastic process through its Ito's definition:

:defsto(t,x)
:Func
:{t,x}
:EndFunc

So for our TI-calculator, a diffusion process formally defined by:

dS = f(S,t) dt + g(S,t) dW

is defined by a set of two terms:

{ f(S,t), g(S,t) }

For an exponential brownian motion, we define:

  • s, sigma---s) → ds(s)


Now we want to use Ito's lemma on functions of S and t:

:dsto(f,x,t,ds)
:Func
  • d(f,x)+ds[2]^2---d(d(f,x),x)/2" class="copylinks" target="_blank">, ds[2 ---d(f,x)}

  • :EndFunc


This can now be used to apply Ito's lemma to \ln(S):

dsto(ln(S),S,t,ds(S))
>> { m - sigma^2/2 , sigma }

this tell us that:

d \ln(S) = \left(m-{1\over 2}\sigma^2 ight) dt + \sigma dW, \;{ m when}\; dS = m S dt + \sigma S dW


Black-Scholes Equation

Now we can try to prove the Black-Scholes Equation .

Define a portfolio with an option and \Delta shares of S:

  • S → Pi


and apply Ito's lemma to obtain d \Pi:

dsto(Pi, S, t, ds(S)) → dPi

we now want to nullify the stochastic part of d \Pi by chosing an appropriate value for \Delta:

solve( dPi {Link without Title} =0, Delta)
>> Delta = d(V(S,t), S) or sigma S = 0

we now know that the correct value for \Delta is:

\Delta = {\partial V(S,t)\over \partial S}

On another side, we have:

d\Pi = r \Pi dt = r ( V(S,t)-\Delta\cdot S) dt

which leads us to the equation:

(\partial_t V + {1\over 2}\sigma^2 S^2 \partial^2_S V) dt = r ( V(S,t)-\Delta S) dt

At first we need to replace \Delta by its value into d\Pi, and then equalize with

  DPi defsto( r(V(S,t) - Delta S) ) sol &rarr BS