dimanche 21 janvier 2018

sampling uniformly (x,y,z) such that x+y+z=0

I am trying to sample uniformly from the set of all point (x,y,z) such that x+y+z = 0 and -1<=x<=1, -1<=y<=1 and -1<=z<=1.

My idea was the following: I sampled uniformly from the 6 dimensional simplex(following this suggestion), i.e. from the set of points (a,b,c,d,e,f) such that a+b+c+d+e+f= 0 and 0<=a<=1, 0<=b<=1, 0<=c<=1, 0<=d<=1, 0<=e<=1 and 0<=f<=1. Since geometrically the set of all points satifying (1) is a hexagon with vertices (-1,1,0), (-1,0,1), (0,-1,1), (1,-1,0), (1,0,-1) and (0,1,-1), I computed (x,y,z) = a*(-1,1,0)+b*(-1,0,1)+c*(0,-1,1)+d*(1,-1,0)+e*(1,0,-1)+f*(0,1,-1). I sampled half a million points following this method, but unfortunatly, it seems like the points are not uniformly distributed.

Here is a plot

Does anybody know what the problem is with this and how to correct it?




Aucun commentaire:

Enregistrer un commentaire