Research Article

Accuracy, Robustness, and Efficiency of the Linear Boundary Condition for the Black-Scholes Equations

Algorithm 2

%  Cash-or-nothing options
clear;clc;clf;K=100;L=3*K;T=1;sigma=0.35;r=0.05;Nx=L+1;dt=0.01;Nt=round(T/dt);
x=linspace(0,L,Nx);h=x(2)-x(1);
for i=1:Nx
if (x(i) <= K)
payoff(i)=0.0;
else payoff(i)=1.0;
end
end
d=(log(x/K)+(r-sigma2/2)*T)/(sigma*sqrt(T));exact=1.0*exp(-r*T).*normcdf(d); grid on;
hold on;plot(x,payoff,k-,x,exact,r-,LineWidth,1)axis ([0 300 -0.05 1.05])