Figure 9.5:

Multivariate normal for n_p=2.

Figure 9.5

Code for Figure 9.5

Text of the GNU GPL.

main.py


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Converted from threednormal.m - 3-D bivariate normal surface
import numpy as np

a11 = 3.5; a12 = 2.5; a22 = 4.0
xisosamples = 35; yisosamples = 35
x = np.linspace(-2.0, 2.0, xisosamples)
y = np.linspace(-2.44949, 2.44949, yisosamples)
xx, yy = np.meshgrid(x, y)
zz = np.exp(-0.5*(a11*xx**2 + 2*a12*xx*yy + a22*yy**2))

with open('threednormal.dat', 'w') as fh:
    for j in range(yisosamples):
        for i in range(xisosamples):
            fh.write('%f %f %f\n' % (x[i], y[j], zz[j, i]))
        if j < yisosamples - 1:
            fh.write('\n')