# How to find random values of variable satisfying multiple conditions?

I have multiple conditions to be satisfied

Abs[x] < 1 &&
Abs[x] < (1 - 2 Sqrt[Abs[y]] Sqrt[(1 + Abs[y]) (1 + Abs[z])] +
Abs[y] (2 + Abs[z]))/Abs[z] && Abs[y] < 1 && Abs[z] < 1


and I want to find random numerical values of (x,y,z) which satisfies all the above conditions?

I tried using FindInstance but it didn't generate random values.

• use RealAbs instead of Abs to speed up the calculate. – cvgmt Sep 18 at 11:57

You can use ImplicitRegion + RandomPoint:

impreg = ImplicitRegion[Abs[x] < (1 - 2 Sqrt[Abs[y]] Sqrt[(1 + Abs[y]) (1 + Abs[z])] +
Abs[y] (2 + Abs[z]))/Abs[z],
{{x, -1, 1}, {y, -1, 1}, {z, -1,  1}}];

RandomPoint[impreg]

 {-0.765127, -0.0412526, 0.134246}

SeedRandom[1]
randompoints = RandomPoint[impreg, 20];

Show[RegionPlot3D[impreg, PlotStyle -> Opacity[.3]],
Graphics3D[{Red, Sphere[#, .05] & /@ randompoints}]]


We can modified the inequalities to speed up the calculate. Use RealAbs instead of Abs for real numbers.

reg = ImplicitRegion[
RealAbs[x] RealAbs[z] <
1 - 2 Sqrt[RealAbs[y]] Sqrt[(1 + RealAbs[y]) (1 + RealAbs[z])] +
RealAbs[y] (2 + RealAbs[z]), {{x, -1, 1}, {y, -1, 1}, {z, -1,
1}}] // Region
RandomPoint[reg, 1000]


Furthermore, by the symmetric we can assuming that x>=0 && y>=0 && z>=0 and randomly select the sign of the coordinate.

reg = ImplicitRegion[
x*z < 1 - 2 Sqrt[y] Sqrt[(1 + y) (1 + z)] + y (2 + z), {{x, 0,
1}, {y, 0, 1}, {z, 0, 1}}] // Region;
Graphics3D[{Cyan, Point[RandomPoint[reg, 10000]]}]

• If you execute a = ListPointPlot3D[RandomPoint[reg, 1000]];Show[{reg, a}], then you see points outside reg. – user64494 Sep 18 at 17:22