10.8 Numerical Evaluation of Path Integrals
167
Fig. 10.4 Histograms of random numbers from a Gaussian distribution, generated by the
acceptance-rejection method (top) and by the Metropolis-Hastings algorithm (bottom)
10.8 Numerical Evaluation of Path Integrals
We now turn to evaluating the pricing kernel p BS (x) from (10.22) using the representation as path integral from (10.64) with the definition of the actions S BS from
(10.62). After evaluating the path integral using uniformly distributed paths, we then
use paths generated with the Metropolis-Hastings algorithm and finally, with paths,
mimicking the dynamics of the system.
a large number of uniformly distributed random paths in the range of ±4 σ. The
following code snippet illustrates the generation of Npath paths, which are stored
in the matrix x. The first index labels the nslice points and the second index labels
the different paths. Next, the contribution of each slice and for each path to S BS
is calculated and stored in the variable term1. The contribution of the first slice,
starting at x 0 = 0, is calculated separately and stored in term2.
Npath=20000000;
x=-4*sigma+8*sigma*rand(nslice,Npath);
term1=sum((x(2:end,:)-x(1:end-1,:)+dt*rfhat).ˆ2,1);
term2=(x(1,:)+dt*rfhat).ˆ2;
eSBS=exp(-(term1+term2)/(2*dt*sigmaˆ2));
Both terms enter in the calculation of e
S BS , in the script denoted by eSBS, with
S BS given in (10.62). Note that we have not included the discount factor εr f N and
postpone the normalization of the path integral until later.
We complete the calculation of the path integral in the following code segment,
where we first cast the end positions of the paths onto a grid xx with spacing σ/5,
Précédent

- 175/292

Suivant