# What are the boundary conditions for the Forward contract PDE?

## European call

When solving the PDE for the value $$V$$ of a European call option under the Black-Scholes model using a finite difference scheme, we have that

• Initial/terminal condition. $$V(S_T,T) = \text{payoff}(S_T) = \max(S_T-K,0)$$ (initial since the scheme is solved backward, terminal since it holds at the final time $$T$$)
• Left end boundary condition. If $$S_0=0$$ then $$S_t=0$$ for all $$t$$ and the option will surely be out of the money with payoff $$\max(0-K,0)=0$$ and $$V(0,t)=0$$ for all $$t$$
• Right end boundary condition. If $$S_0$$ is large enough (w.r.t. to $$K$$) then $$S_t>K$$ for all $$t$$ and the option will end up in the money with payoff $$\max(S_t-K,0)=S_t-K$$ and $$V(S_t,t)=S_t-Ke^{-r(T-t)}$$ for all $$t$$

## Forward contract

How to deduce the boundary conditions in a similar manner when solving the PDE for the value of a forward contract whose underlying follows the Schwartz mean reverting model? What I understand until now about forwards is

• There is no money exchanged when signing a forward contract so, using the notation below, I think that the value of the forward at time 0 is $$F(S_0,0)=0$$
• The payoff (of the option equivalent to this forward contract) is $$S_T-K$$ since the holder is obliged to buy the underlying at expiry

The Schwartz model is $$dS = \alpha(\mu-\log S)Sdt + \sigma S dW$$ with $$\alpha$$ speed of mean reversion. From this eq it is possible to derive the PDE for the value of the forward

$$\tag1 \frac{\partial F}{\partial t} + \alpha\Big(\mu-\lambda -\log S\Big)S\frac{\partial F}{\partial S}+\frac12\sigma^2S^2\frac{\partial^2F}{\partial S^2} = 0, \qquad \text{with }\lambda = \sigma\frac{\mu-r}\alpha$$

whose solution is, letting $$\tau=T-t$$

$$\tag2 F(S_t,\tau) = \mathbb E[S_t] = \exp\bigg(e^{-\alpha\tau}\log S_t +\Big(\mu-\frac{\sigma^2}{2\alpha}-\lambda\Big)(1-e^{-\alpha\tau})+\frac{\sigma^2}{4\alpha}(1-e^{-2\alpha\tau})\bigg)$$

• Initial/terminal condition. Plugging $$\tau=0$$ (ie $$t=T$$) in $$(2)$$ we get $$F(S_T,0) = \exp(\log S_T) = S_T$$. This value appears also in the original paper by Schwartz (at page 5), so it is correct.
• Left end boundary condition. As in the European call case, if $$S_0=0$$ then $$S_t=0$$ for all $$t$$ and from $$(1)$$ we get $$\dfrac{\partial F}{\partial t}=0$$ ie $$F$$ does not change in time, and since as said before $$F(S_0,0)=0$$ (not sure though) it follows $$F(0,t)=0$$ for all $$t$$. But this means that the payoff of the option would be $$0-K$$ that is negative, since prices cannot be negative how to deal with this fact?
• Right end boundary condition. If $$S_0$$ is large enough (w.r.t. to $$K$$) then $$S_t>K$$ for all $$t$$ and the payoff of the option will be $$F(S_t,t)-K$$ and $$V(S_t,t)=(F(S_t,t)-K)e^{-r(T-t)}$$ for all $$t$$, but what can we say about the value of $$F(S_t,t)$$?

At the end of the finite difference scheme, to obtain the value of the option at time 0 we compute $$V(S_0,0) = (F(S_0,0)-K)e^{-rT}$$ which in general is not 0, in contrast with what I said above about $$F$$ being 0 at time 0. What is wrong in the reasoning?

## Code

What follows is the Matlab code that computes the exact value of the option at time 0 (V_exact) and the value approximated by the Euler explicit finite difference scheme (V_euler). The initial/terminal condition is applied at line 26 (F = ST), the next two lines are for the left end condition (F(1) = 0) and the right end condition (I don't know what to put here).

Moreover, I'm not sure that V_exact is computed correctly, should be (F-K)*exp(-r*T) or F-K*exp(-r*T)?

S0 = 22.93; % spot price at time 0
r = .1; % risk-free interest rate
T = 1/2; % expiry time
K = 18; % strike price

alpha = 0.069217; %
sigma = 0.087598; % estimated from data
mu = 3.058244;    %

tau = T-0; % time to expiry
F = exp( exp(-alpha*tau)*log(S0) + (mu-sigma^2/2/alpha-sigma*(mu-r)/alpha)*(1-exp(-alpha*tau)) + sigma^2/4/alpha*(1-exp(-2*alpha*tau)) );
V_exact = (F-K)*exp( -r*tau ); % or is it V_exact = F - K*exp( -r*tau ) ?

%% Euler Explicit Finite Difference Scheme

n = 3000; % number of time steps
dt = T/n; % delta t
domain = [0 3*K];  % truncation of the domain [0,inf)
m = 100; % number of spot prices
ST = linspace(domain(1),domain(2),m); % spot prices at time T (0, 0+dx, 0+2*dx 0+3*dx and so on)
dx = ST(2)-ST(1); % delta x
fprintf('dt/dx^2 = %f\n',dt/dx^2) % should be <= 0.5 to have stability

S = ST(2:end-1); % exclude first and last
F = ST; % initial/terminal condition
F(1) = 0; % left end condition, correct?
% F(end) = ; % right end condition, what to put here?
for m = 1:n
F(2:end-1) = S*dt/2/dx.*( -alpha*mu+sigma*(mu-r)+alpha*log(S)+sigma^2*S/dx).*F(1:end-2) ...
+                                       (1-sigma^2*S.^2*dt/dx^2).*F(2:end-1) ...
+ S*dt/2/dx.*(  alpha*mu-sigma*(mu-r)-alpha*log(S)+sigma^2*S/dx).*F(3:end);
end
V_euler = interp1(ST,(F-K)*exp(-r*T),S0 , 'spline');
fprintf( 'V_exact = %f\nV_euler = %f\n  error = %f\n' , V_exact , V_euler , abs(V_euler-V_exact) )


## Plot

This is the plot with spot prices at time T (vector ST in the code) on x-axis and option prices at time 0 ((F-K)*exp(-r*T) in the code) on y-axis. As you can see the there is a problem when the option price approaches the biggest value of the spot price, since the curve goes from linear to exponential, I guess this is due to the fact that the right end condition is missing