We will in general not go into detail about more standard numerical problems not connected to finance, there are a number of well known sources for such, but we show the example of calculations involving the normal distribution.
The normal distribution is also defined for several random variables. We then characterise the
vector of random variables
The most used multivariate normal calculation is the bivariate case, where we let and be bivariate normally distributed, each with mean 0 and variance 1, and assume the two variables have correlation of . By the definition of correlation . The cumulative probability distribution
There are several approximations to this integral. We pick one such, discussed in (Hull, 1993, Ch 10), shown in code A.3
If one has more than two correlated variables, the calculation of cumulative probabilites is a nontrivial problem. One common method involves Monte Carlo estimation of the definite integral. We will consider this, but then it is necessary to first consider simulation of random normal variables.
Generation of random numbers is a large topic and is treated at length in such sources as Knuth (1997). The generated numbers can never be truly random, only ``pseudo''-random, they will be generated according to some reproducible algorithm and after a (large) number of random number generations the sequence will start repeating itself. The number of iterations before replication starts is a measure of the quality of a random number generator. For anybody requiring high-quality random number generators the rand() function provided by the standard C ++ library should be avoided, but for not getting into involved discussion of random number generations we use this function as a basis for the generation of uniformly distributed numbers in the interval , as shown in code A.4.
These uniformly distributed distributed random variates are used as a basis for the Polar method for normal densities discussed in Knuth (1997) and inplemented as shown in code A.5
When moving beyond
Tong (1990) discusses the multivariate normal distribution, and is a good reference.