
This section contains a short description of the adaptive Monte Carlo program
VEGAS. See for details \cite{Lepage, NumRecFORT}.

%1. Lepage, G.P. 1978, Journal of Computational Physics, Vol.27, pp.192-203.
%2. W.H.Press,S.A.Teukolsky,W.T.Vetterling,B.P. Flannery "Numerical Recipes
%in Fortran", Cambridge University Press 1992.

 The Monte Carlo method reduces a task of integral evaluation to 
the task of  mean value  calculation.  Let $g(x)$ is a density 
function satisfying  

      $$ \int \! g(x) \,dx = 1,$$
then 
      $$ \int \! f(x) \, dx = \int \! f(x)/g(x) \, \,g(x) \, dx = \;
 <\!\!f/g\!\!> \; = \lim_{ N \to \infty} \sum (f(x_i)/g(x_i)) / N, $$
where points $x_i$ are sampled with the  probability density $g(x) \, dx.$

 The uncertainty $\sigma_N$  of $<\!f/g\!>$ estimation  by $N$ sample points 
is  proportional to  square root of function's  variance divided over $N$:  
   $$\sigma_N =  \sqrt{ (<\!\!(f/g)^2\!\!> - <\!\!f/g\!\!>^2)  / N }\;. $$
VEGAS uses two techniques which allow to decrease the uncertainty of Monte
Carlo calculation, namely the {\it importance sampling}  and the 
{\it stratified sampling}.   


\subsubsection{Importance sampling}

The idea of importance sampling technique is based on diminution   of variance by  
a proper choice of the density function  g(x). The general solution of this
problem could be in choosing 
      $$ g(x) = |f(x)| \; / \int \! |f(x)| \,dx.$$
      
However this solution is useless because  it returns us to the problem
of evaluation of $f(x)$  integral   and requires a generation of sampling
points for complicated density function.  
  
  To bypass these problems  VEGAS seeks  this function 
in the factored form 
     $$g(x_1, x_2, \ldots ,x_n) = g_1(x_1) \, g_2(x_2)  \ldots g_n(x_n).$$
The optimal functions $g_i(x)$ could be easily evaluated in terms of $f(x)$
\cite{Lepage, NumRecFORT}.
VEGAS is an adaptive program. For the first iteration it puts $g_i(x)=1.$
The information about $f(x)$ which VEGAS gets during the iteration 
is used to refine the density function. Generally VEGAS performs several
iterations improving the density function after each of them.

 The following parameters manage VEGAS work:
 \begin{enumerate}
\item {\it Itmx}  is a  number of iterations;
\item {\it Ncall} is a number of integrand calls for one iteration.
\end{enumerate}

\subsubsection{Stratified sampling}
 
The idea of stratified sampling method is to divide a volume of 
integration into a large number of sub-volumes and calculate integrals
separately in each sub-volume. This method produces a smaller uncertainty
comparing with  the  direct Monte Carlo method  because here the uncertainty 
is  caused only by a function  variance in the  sub-volumes, while 
the integrand variation from one sub-volume to another  does not 
contribute to the uncertainty. 

  The stratified sampling method is used to estimate the integral for 
any VEGAS iteration. The larger number Ncall is chosen, the smaller
size of sub-volume becomes available and, consequently, the more
successfully the stratified sampling works.


%\end{verbatim}
