3

I would like to integrate over a dilationed region in higher dimensions.

In 3 dimensions it works well.

(*Nintegrate over a 3 dim region*)
regS = Simplex[{{1, 0, 0}, {0, 1, 0}, {0, 0, 
     1}, {-(1/3), -(1/3), -(1/3)}}];
regSdil = RegionDilation[regS, 0.1];
NIntegrate[1, {x, y, z} \[Element] regS]  (*0.333*)
NIntegrate[1, {x, y, z} \[Element] regSe] (*0.764*)

But in 4 dimensions I got the following error message: "Invalid integration variable or limit(s)"

(*Nintegrate over a 4 dim region*)
regS = Simplex[{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 
     1}, {1/4 (1 - Sqrt[5]), 1/4 (1 - Sqrt[5]), 1/4 (1 - Sqrt[5]), 
     1/4 (1 - Sqrt[5])}}];
regSdil = RegionDilation[regS, 0.1];
NIntegrate[1, {x, y, z, k} \[Element] regS]  (*0.0931*) 
NIntegrate[1, {x, y, z, k} \[Element] 
  regSdil] (***"Invalid integration variable or limit(s)"***) 

I don't know why. Is there a way to solve this. Or is there a better way to do such a calculation?

cvgmt
  • 72,231
  • 4
  • 75
  • 133
Zsombor
  • 163
  • 3
  • 1
    The problem is with RegionDilation, not the integration. If you evaluate RegionQ[regSdil], you'll get False. So RegionDilation does not produce a 4-dimensional region. It works in simpler 4D cases, e.g., RegionDilation[Ball[{0,0,0,0}],0.1] gives a larger 4D ball. – tad Jan 23 '24 at 21:46

1 Answers1

6
  • RegionDilation seems only work for simple region in higher dimensions.
RegionDilation[Ball[{0, 0, 0, 0}, 1], .1]
RegionDilation[Ball[{0, 0, 0, 0}, 1], Ball[{0, 0, 0, 0}, .1]]

Ball[{0, 0, 0, 0}, 1.1]

  • We try to add sphere points around the 5 points of the simplex regS and construct a ConvexHullRegion and integrate on such dilation region of regS.

  • Version 13.3.1, Version 14.0.0

Clear["Global`*"];
regS = Simplex[{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 
     1}, {1/4   (1 - Sqrt[5]), 1/4   (1 - Sqrt[5]), 
     1/4   (1 - Sqrt[5]), 1/4   (1 - Sqrt[5])}}];
pts = regS[[1]];
r = .1;
regdilation = 
  ConvexHullRegion[
   Flatten[Outer[Plus, pts, RandomPoint[Sphere[{0, 0, 0, 0}, r], 200],
      1], 1]];
ineqs = First@regdilation /. 
   Thread[{Indexed[\[FormalX], {1}], Indexed[\[FormalX], {2}], 
      Indexed[\[FormalX], {3}], Indexed[\[FormalX], {4}]} -> {x, y, z,
       w}];
NIntegrate[
 Boole[ineqs], {x, y, z, w} ∈ 
  Cuboid @@ 
   Transpose[{First@# - 2 r, Last@# +2 r} & /@ RegionBounds[regS]]]

0.264839.

  • Version 11.3 , Version 12.2
Clear["Global`*"];
regS = Simplex[{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 
     1}, {1/4   (1 - Sqrt[5]), 1/4   (1 - Sqrt[5]), 
     1/4   (1 - Sqrt[5]), 1/4   (1 - Sqrt[5])}}];
r = .1;
{{x1, x2}, {y1, y2}, {z1, z2}, {w1, 
    w2}} = {First@# - 2 r, Last@# + 2 r} & /@ RegionBounds[regS];
NIntegrate[
 Boole[RegionDistance[regS, {x, y, z, w}] <= r], {x, x1, x2}, {y, y1, 
  y2}, {z, z1, z2}, {w, w1, w2}]

0.277332.

cvgmt
  • 72,231
  • 4
  • 75
  • 133
  • It is a pity that this Integrating a function over a region defined as the epsilon-neighborhood of a triangle cannot be generalized in this case! Any idea why? – Ulrich Neumann Jan 24 '24 at 14:02
  • @UlrichNeumann I found that theRegionDistance approach work in 11.3 and 12.2 but not in 14.0 version. – cvgmt Jan 24 '24 at 15:28
  • Thanks! I tried ball4D = ImplicitRegion[ u1^2 + u2^2 + u3^2 + u4^2 <= .1, {u1, u2, u3, u4}] regS = Simplex[{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1/4 (1 - Sqrt[5]), 1/4 (1 - Sqrt[5]), 1/4 (1 - Sqrt[5]), 1/4 (1 - Sqrt[5])}}]; pts = regS[[1]] sol = Resolve[ Exists[{v1, v2, v3, v4, u1, u2, u3, u4}, {v1, v2, v3, v4} \[Element] regS && {u1, u2, u3, u4} \[Element] ball4D, {x1, x2, x3, x4} == {v1, v2, v3, v4} + {u1, u2, u3, u4}] , Reals] reg = ImplicitRegion[sol, {x1, x2, x3, x4}]; without success – Ulrich Neumann Jan 24 '24 at 16:00
  • Thanks! I like the idea, how you generate the dilationed region using ConvexHullRegion! Unfortunately the Nintegrate gives me error messages: (1) "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small." (2) "The global error of the strategy GlobalAdaptive has increased more than 2000 times" instead of decreasing." I have tried increasing the number of points, but the integral does not seem to converge. – Zsombor Jan 25 '24 at 15:26
  • As I increase the number of random points of the spheres, these are the results with errors: 50 points: 0.266 + /- 0.061 100 points: 0.27 + /- 0.051 200 points: 0.282 + /- 0.064 500 points: 0.288 + /- 0.066 Is there any idea how to reduce errors? – Zsombor Jan 25 '24 at 15:29