I'm trying to create a simulation that requires me to vary a set of probabilities, i.e., the variables must add up to 1.
When I wanted to vary the parameters of a set of 3 probabilities, I treated each parameter as an axis in 3D space and parametrized a circle on the plane x + y + z = 1 using the equations p0 + rcos(v) (dot) u1 + rsin(v) (dot) u2, where p0 is the point denoting the original probabilities, u1 and u2 are perpendicular vectors parallel to the plane, (dot) denotes a dot product, and r and v are free variables. By varying r and choosing several points along 2pi for v, I could generate a set of probabilities that were close to the original while still being valid, satisfying our constraint.
The problem I now have is when I try to do this for a set of 4 probabilities, i.e. A 4D space, I can't visualize or find a way to extend this system of equations. Is there a way to achieve something similar to what I have for the 3D case for the 4D case? Is my original way of generating probabilities for 3D stupid and if so what is the standard method of doing so?
First consider a different approach to the 3d case, that doesn't require any trigonometry:
You're interested in the sum of a vector's elements, call that S(v).
v = (2, 3, 5) S(v) = 10
And you're interested in the S = 1 plane, which has a normal vector we'll call k:
k = (1/3, 1/3, 1/3) = (1/3)(1, 1, 1)
You have a point p0 in that plane (S(p0)=1), and you want some points in the plane at a distance r from p0.
Start with some points chosen randomly with uniform distribution in a unit sphere around the origin x2+y2+z2 < 1. (This is easy, just choose points uniformly from the cube surrounding that sphere, and reject the ones outside the sphere.)
Now project each of those points onto the S=0 plane:
v -> v - S(v)k
(Stare at that until it makes sense.) You now have points scattered in a disk of radius 1, normal to k. They are not uniform in the disk, they are thicker near the middle, but they are uniform in angle. Now scale each point to move it to the circle of radius r:
v -> v r/|v|
Now move the ring of points to be centered on p0:
v -> v + p0
Now here's the kicker. Everything you just did works in n dimensions as easily as in 3.