4
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ use RealAbs instead of Abs to speed up the calculate. $\endgroup$
    – cvgmt
    Sep 18, 2020 at 11:57

2 Answers 2

5
$\begingroup$

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}]]

enter image description here

$\endgroup$
0
3
$\begingroup$

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]

enter image description here

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]]}]
$\endgroup$
1
  • $\begingroup$ If you execute a = ListPointPlot3D[RandomPoint[reg, 1000]];Show[{reg, a}], then you see points outside reg. $\endgroup$
    – user64494
    Sep 18, 2020 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.