So I'm trying to solve the black scholes equation using a finite difference model, but I'm getting a answer that's off and I'm having trouble understanding why.

This is the result for a option with K = 100.0, r = 0.12, and sigma = 0.10


The left side is higher than it should be, and should start flat, but the right side is fairly close. This is the equation I'm solving:

$$ - \frac{\partial}{\partial t} V(t,s) + r\ s\ \frac{\partial}{\partial s} V(t,s) + \frac{1}{2}\ \sigma^2\ s^2\ \frac{\partial^2}{\partial s^2} V(t,s) - r\ V(t,s) = 0 $$

Here is a graph comparing the solution to a graph of values from the discretized formula, blue line is the correct values, and the yellow line is what I'm getting. This is at expiration with t=1

def euro_call_sym(S, K, T, r, sigma):
    N = Normal('x', 0.0, 1.0)
    d1 = (sympy.ln(S / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sympy.sqrt(T))
    d2 = (sympy.ln(S / K) + (r - 0.5 * sigma ** 2) * T) / (sigma * sympy.sqrt(T))

    call = (S * cdf(N)(d1) - K * sympy.exp(-r * T) * cdf(N)(d2))
    return call


To generate my result I'm not using any boundary conditions, with one sided left derivatives on one point on the right edge and centered derivatives on the rest.

Does anyone know what boundary conditions would fix the behavior on the left side of the graph?

  • 2
    $\begingroup$ Shouldn't the PDE be +dV/dt? Or are you using time to maturity as "t"? $\endgroup$ May 8, 2020 at 6:22
  • $\begingroup$ t=1 is at expiration, I took the form from this paper (researchgate.net/publication/319183251), when I switch the term to positive it's unstable $\endgroup$
    – rawsh
    May 8, 2020 at 18:31

2 Answers 2


Not sure if the problem is down to boundary conditions - could be a lot of other things, but the boundary conditions in the simplest form for call options are:

  • For very large S: $V\left(t,S\right) \approx S$
  • For very small S: $V\left(t,S\right) \approx 0$

For put option, the equivalent boundary conditions are:

  • For very large S: $V\left(t,S\right) \approx 0$
  • For very small S: $V\left(t,S\right) \approx K e^{-r(T-t)}$

The initial condition for each is just the option payoff at maturity.

As an aside, you can also reverse time, and in this case it is also easy to get rid of the variable coefficient by setting $x=\ln S$, and one can then transform the equation to the heat equation, which is relatively easy to handle with finite difference.


I fixed this later, the issue was the forward derivative I was using on the left. For other people trying to do something similar, the key to success for me was the following:

  • neumann boundary condition on the right (or a one sided backward derivative on a single point)
  • pad the left side so that V starts at 0
  • boundary conditions from Magic's answer

Here are my results (K=100, r=12%, sigma=10%)

2d 3d


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.