Python
numpy

Gaussian distribution sample using numpy

def _where(w):
 w = np.array(w)
 print(w)
 for i,j in w.T:
  print("x:"+str(i)+",y:"+str(j)+",G:"+str(G[i,j])+",D:"+str(D[i,j])+",X:"+str(X[i,j])+",Y:"+str(Y[i,j]))

print("====sqrt(2)====")
print(np.sqrt(2))
X, Y = np.meshgrid(np.linspace(-1,1,10), np.linspace(-1,1,10))
D = np.sqrt(X*X+Y*Y)
print("====X====")
print(X)
print("====Y====")
print(Y)
print("====D====")
print(D)
sigma, mu = 1.0, 0.0
G = np.exp(-( (D-mu)**2 / ( 2.0 * sigma**2 ) ) )
print("====G====")
print(G)
print("====min====")
_where(np.where(G == G.min()))
print("====max====")
_where(np.where(G == G.max()))
====sqrt(2)====
1.41421356237
====X====
[[-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]
 [-1.         -0.77777778 -0.55555556 -0.33333333 -0.11111111  0.11111111
   0.33333333  0.55555556  0.77777778  1.        ]]
====Y====
[[-1.         -1.         -1.         -1.         -1.         -1.         -1.
  -1.         -1.         -1.        ]
 [-0.77777778 -0.77777778 -0.77777778 -0.77777778 -0.77777778 -0.77777778
  -0.77777778 -0.77777778 -0.77777778 -0.77777778]
 [-0.55555556 -0.55555556 -0.55555556 -0.55555556 -0.55555556 -0.55555556
  -0.55555556 -0.55555556 -0.55555556 -0.55555556]
 [-0.33333333 -0.33333333 -0.33333333 -0.33333333 -0.33333333 -0.33333333
  -0.33333333 -0.33333333 -0.33333333 -0.33333333]
 [-0.11111111 -0.11111111 -0.11111111 -0.11111111 -0.11111111 -0.11111111
  -0.11111111 -0.11111111 -0.11111111 -0.11111111]
 [ 0.11111111  0.11111111  0.11111111  0.11111111  0.11111111  0.11111111
   0.11111111  0.11111111  0.11111111  0.11111111]
 [ 0.33333333  0.33333333  0.33333333  0.33333333  0.33333333  0.33333333
   0.33333333  0.33333333  0.33333333  0.33333333]
 [ 0.55555556  0.55555556  0.55555556  0.55555556  0.55555556  0.55555556
   0.55555556  0.55555556  0.55555556  0.55555556]
 [ 0.77777778  0.77777778  0.77777778  0.77777778  0.77777778  0.77777778
   0.77777778  0.77777778  0.77777778  0.77777778]
 [ 1.          1.          1.          1.          1.          1.          1.
   1.          1.          1.        ]]
====D====
[[ 1.41421356  1.26686158  1.1439589   1.05409255  1.0061539   1.0061539
   1.05409255  1.1439589   1.26686158  1.41421356]
 [ 1.26686158  1.09994388  0.95581392  0.84619701  0.7856742   0.7856742
   0.84619701  0.95581392  1.09994388  1.26686158]
 [ 1.1439589   0.95581392  0.7856742   0.64788354  0.56655772  0.56655772
   0.64788354  0.7856742   0.95581392  1.1439589 ]
 [ 1.05409255  0.84619701  0.64788354  0.47140452  0.35136418  0.35136418
   0.47140452  0.64788354  0.84619701  1.05409255]
 [ 1.0061539   0.7856742   0.56655772  0.35136418  0.15713484  0.15713484
   0.35136418  0.56655772  0.7856742   1.0061539 ]
 [ 1.0061539   0.7856742   0.56655772  0.35136418  0.15713484  0.15713484
   0.35136418  0.56655772  0.7856742   1.0061539 ]
 [ 1.05409255  0.84619701  0.64788354  0.47140452  0.35136418  0.35136418
   0.47140452  0.64788354  0.84619701  1.05409255]
 [ 1.1439589   0.95581392  0.7856742   0.64788354  0.56655772  0.56655772
   0.64788354  0.7856742   0.95581392  1.1439589 ]
 [ 1.26686158  1.09994388  0.95581392  0.84619701  0.7856742   0.7856742
   0.84619701  0.95581392  1.09994388  1.26686158]
 [ 1.41421356  1.26686158  1.1439589   1.05409255  1.0061539   1.0061539
   1.05409255  1.1439589   1.26686158  1.41421356]]
====G====
[[ 0.36787944  0.44822088  0.51979489  0.57375342  0.60279818  0.60279818
   0.57375342  0.51979489  0.44822088  0.36787944]
 [ 0.44822088  0.54610814  0.63331324  0.69905581  0.73444367  0.73444367
   0.69905581  0.63331324  0.54610814  0.44822088]
 [ 0.51979489  0.63331324  0.73444367  0.81068432  0.85172308  0.85172308
   0.81068432  0.73444367  0.63331324  0.51979489]
 [ 0.57375342  0.69905581  0.81068432  0.89483932  0.9401382   0.9401382
   0.89483932  0.81068432  0.69905581  0.57375342]
 [ 0.60279818  0.73444367  0.85172308  0.9401382   0.98773022  0.98773022
   0.9401382   0.85172308  0.73444367  0.60279818]
 [ 0.60279818  0.73444367  0.85172308  0.9401382   0.98773022  0.98773022
   0.9401382   0.85172308  0.73444367  0.60279818]
 [ 0.57375342  0.69905581  0.81068432  0.89483932  0.9401382   0.9401382
   0.89483932  0.81068432  0.69905581  0.57375342]
 [ 0.51979489  0.63331324  0.73444367  0.81068432  0.85172308  0.85172308
   0.81068432  0.73444367  0.63331324  0.51979489]
 [ 0.44822088  0.54610814  0.63331324  0.69905581  0.73444367  0.73444367
   0.69905581  0.63331324  0.54610814  0.44822088]
 [ 0.36787944  0.44822088  0.51979489  0.57375342  0.60279818  0.60279818
   0.57375342  0.51979489  0.44822088  0.36787944]]
====min====
[[0 0 9 9]
 [0 9 0 9]]
x:0,y:0,G:0.367879441171,D:1.41421356237,X:-1.0,Y:-1.0
x:0,y:9,G:0.367879441171,D:1.41421356237,X:1.0,Y:-1.0
x:9,y:0,G:0.367879441171,D:1.41421356237,X:-1.0,Y:1.0
x:9,y:9,G:0.367879441171,D:1.41421356237,X:1.0,Y:1.0
====max====
[[4 4 5 5]
 [4 5 4 5]]
x:4,y:4,G:0.987730216236,D:0.157134840264,X:-0.111111111111,Y:-0.111111111111
x:4,y:5,G:0.987730216236,D:0.157134840264,X:0.111111111111,Y:-0.111111111111
x:5,y:4,G:0.987730216236,D:0.157134840264,X:-0.111111111111,Y:0.111111111111
x:5,y:5,G:0.987730216236,D:0.157134840264,X:0.111111111111,Y:0.111111111111

Refs.