I am trying to solve the BlackScholes PDE for Barrier option. It works fine for european barrier, but errors out on american boundary condition
sol1 = NDSolve[{D[V[S, t], t] + r*S*D[V[S, t], S] +
1/2 sigma^2 S^2 D[V[S, t], {S, 2}] - r V[S, t] == 0,
V[S, t] == Piecewise[{{0, S >= 120}, {Max[S - K, 0], S < 120}}]},V, {S, 0.1, 1000}, {t, 0, T}]
If I change the boundary condition to capital "T", it works fine
V[S, T] == Piecewise[{{0, S >= 120}, {Max[S - K, 0], S < 120}}]}
If it's for any time t, then it complains about fewer dependent variables. Is there any other way to specify boundary condition for 2 variables? It seems a simple issue, but can't find anything in mathematica documentation!
V
for allS
andt
, which eliminates it as a dependent variable; hence, the error. Changingt
toT
turns the second equation into a bouncary condition, and all is well. You need a boundary condition int
too, something likeV[S,0] == 0
. Also, note thatsigma
andK
are undefined. Although it does not matter here, it is bad practice to begin variable names with capital letters, because Mathematica functions also begin with capital letters. $\endgroup$