Hot answers tagged

7

You can use Sphere instead of ImplicitRegion: RandomPoint[Sphere[{0,0,0,0}, 1], 2] {{0.318231, -0.429109, -0.496487, 0.684175}, {-0.623644, 0.379281, -0.651925, 0.205445}} Or with higher dimensions: RandomPoint[Sphere[{0,0,0,0,0,0,0,0,0,0}, 1], 2] {{-0.17768, 0.211006, -0.112154, 0.200347, -0.282798, -0.433921, -0.502452, 0.126637, 0.0389269, 0.576989}, {-...


5

x^2 + y^2 + z^2 + p^2 == 1 is the surface of a hypersphere. Since the surface has no thickness, RandomPoint has difficulty in locating a point. If instead you give the surface some small thickness, it can more readily be done. Clear["Global`*"] region = ImplicitRegion[1 - 10^-5 < x^2 + y^2 + z^2 + p^2 <= 1, {x, y, z, p}]; SeedRandom[1234] ...


3

Clear["`*"]; x := Sin[a] Sin[b] Sin[c]; y := Sin[a] Sin[b] Cos[c]; z := Sin[a] Cos[b]; p := Cos[a]; x^2 + y^2 + z^2 + p^2 // FullSimplify; pts = Table[{x, y, z, p} /. Thread[{a, b, c} -> {RandomReal[{0, Pi}], RandomReal[{0, Pi}], RandomReal[{0, 2 Pi}]}], 10000]; Graphics3D[Point[Most /@ pts]] projected to xyz plane.


Only top voted, non community-wiki answers of a minimum length are eligible