A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

3 of 5 edited title

# Boundary Conditions for the given PDE

I'm working on the Black-Scholes equation, but I'm pretty new to financial modeling. Right now, I am trying to understand the Black-Scholes PDE. I understand that the Black-Scholes equation is given by $$\begin{equation*} \frac{\partial C}{\partial t} + \frac{1}{2}\sigma^2 S^2\frac{\partial^2 C}{\partial S^2} + rS \frac{\partial C}{\partial S} - rC = 0 \end{equation*}$$ with initial condition $$\begin{equation*} C(S,T) = \max (S-K, 0) \end{equation*}$$ and boundary conditions $$\begin{equation*} C(0,t) = 0 \hspace{35pt} C(S,t) \rightarrow S \text{ as } S \rightarrow \infty \end{equation*}$$ and $$C(S,t)$$ is defined over $$0 < S < \infty$$, $$0 \leq t \leq T$$.

This can be further transformed and simplified into a heat diffusion equation as described here.

If we make the following change of variable $$\begin{equation*} u = e^{-r\tau}C \hspace{20pt} \text{ or } \hspace{20pt} C = ue^{r\tau} \end{equation*}$$ and $$\begin{equation*} S = e^x \hspace{25pt} \text{ and } \hspace{25pt} t = T- \tau \hspace{20pt} \end{equation*}$$ we get the transformed heat equation

$$\begin{equation*} \frac{\partial u}{\partial \tau} = \frac{\partial^2 u}{\partial x^2} + (k-1)\frac{\partial u}{\partial x} - ku \end{equation*}$$

The following matlab code implements this. My question is, what exactly is the form of the boundary conditions for the the transformed equation? I can't seem to understand the parameters (related to the boundary conditions) given in the Matlab code. Any related literature would be highly appreciated.