14.4 Variational Monte Carlo for Quantum Mechanical Systems 465
EL(x) =α^2 +x^2 ( 1 −α^4 ),
with the expectation value for the Hamiltonian of Eq. (14.4)given by
〈EL〉=
∫∞
−∞
|ψT(x)|^2 EL(x)dx,
which reads with the above trial wave function
〈EL〉=
∫∞
−∞dxe−x
(^2) α (^2) α (^2) +x (^2) ( 1 −α (^4) )
∫∞
−∞dxe−x
(^2) α 2.
Using the fact that ∫
∞
−∞
dxe−x
(^2) α 2
√
π
α^2 ,
we obtain
〈EL〉=α
2
2
+^1
2 α^2
.
and the variance
σ^2 =
(α^4 − 1 )^2
2 α^4. (14.7)
In solving this problem we can choose whether we wish to use the Metropolis algorithm and
sample over relevant configurations, or just use random numbers generated from a normal
distribution, since the harmonic oscillator wave functions follow closely such a distribution.
The latter approach is easily implemented, as seen in this listing
... initialisations, declarations of variables
... mcs = number of Monte Carlo samplings
// loop over Monte Carlo samples
for( i=0; i < mcs; i++){
// generate random variables from gaussian distribution
x = normal_random(&idum)/sqrt2/alpha;
local_energy = alphaalpha + xx(1-pow(alpha,4));
energy += local_energy;
energy2 += local_energylocal_energy;
// end of sampling
}
// write out the mean energy and the standard deviation
cout << energy/mcs << sqrt((energy2/mcs-(energy/mcs)**2)/mcs));
This variational Monte Carlo calculation is rather simple,we just generate a large number
Nof random numbers corresponding to a gaussian probability distribution function (which
resembles the ansatz for our trial wave function∼|ΨT|^2 ) and for each random number we
compute the local energy according to the approximation
〈ÊL〉=
∫
P(R)ÊL(R)dR≈
1
N
N
∑
i= 1
EL(xi),
and the energy squared through
〈̂E^2 L〉=
∫
P(R)Ê^2 L(R)dR≈^1
N
N
∑
i= 1
E^2 L(xi).
In a certain sense, this is nothing but the importance Monte Carlo sampling discussed in
chapter 11. Before we proceed however, there is an importantaside which is worth keeping
in mind when computing the local energy. We could think of splitting the computation of the