# Finding region, between four hyperplanes, useful for integration

Consider the function $$f(x,y,u,v) = \exp\bigl( -x^2 -y^2 -u^2 -v^2 \bigr),$$ and the region $$\mathcal{R} = \cap_{i=1}^4 \mathcal{R}_i$$ defined by four hyperplanes as follows \begin{align} \mathcal{R}_1 &= -((22843 s_1)/31868) + (14292 s_2)/29563 - (10538 s_3)/7331 + ( 13943 s_4)/12802 > 0,\\ \mathcal{R}_2 &= -((14321 s_1)/28058) + (20843 s_2)/23538 + (10097 s_3)/12866 - ( 27212 s_4)/17791 > 0,\\ \mathcal{R}_3 &= (22843 s_1)/31868 + (14292 s_2)/29563 - (10538 s_3)/7331 - ( 13943 s_4)/12802 > 0, \\ \mathcal{R}_4 &= (14321 s_1)/28058 + (20843 s_2)/23538 + (10097 s_3)/12866 + ( 27212 s_4)/17791 > 0 \end{align} in code

R=-((22843 s[1])/31868) + (14292 s[2])/29563 - (10538 s[3])/7331 + (
13943 s[4])/12802 >
0 && -((14321 s[1])/28058) + (20843 s[2])/23538 + (10097 s[3])/
12866 - (27212 s[4])/17791 >
0 && (22843 s[1])/31868 + (14292 s[2])/29563 - (10538 s[3])/7331 - (
13943 s[4])/12802 >
0 && (14321 s[1])/28058 + (20843 s[2])/23538 + (10097 s[3])/
12866 + (27212 s[4])/17791 > 0;


I want to compute the integral

NIntegrate[Exp[-s[1]^2-s[2]^2-s[3]^2-s[4]^2], Array[s,4] \[Element] ImplicitRegion[R, Array[s,4]]]



or better yet

Integrate[Exp[-s[1]^2-s[2]^2-s[3]^2-s[4]^2], Array[s,4] \[Element] ImplicitRegion[R, Array[s,4]]]



However, when doing so I obtain the error message

NIntegrate::vedim: The number of variables 4 should match the region embedding dimension 1.


My guess is that Mathematica just gives up finding the reduced region and throws $$0$$ producing this output. Note that using Reduce supposedly reduces the complexity of the expression but while using its output as integration region produces the same error.

Important edit. Long story short; what I wrote in the original question was the actual answer: instead of using s[1], s[2], etc, I was using Array[s,4]. MMA did not expand it before computing the integral. Thus, I changed the original question to reflect this mistake and I will answer my own question.

• My Mathematica instance, 12.1, produces a big piecewise answer for Integrate, and 'DiscretizeRegion only supports dimensions 1 through 3' for NIntegrate. – Adam Mar 1 at 16:04
• @Adam, interesting. Note that I made a mistake writing the integral. Now it's exactly what I want to compute. – David Mar 1 at 16:08
• Integrate decides this one is too complicated, but no error. NIntegrate warns that 'the global error' for 'GlobalAdaptive has increased more than 2000 times' and that its answer of 0.323116 may be wrong. No system error though. What's your version? Maybe you could use Gauss's theorem to get an analytic answer. – Adam Mar 1 at 17:38
• Right. Apparently the problem was that instead of using s[1], s[2],s[3], s[4] explicitly, I used Array[s,4]. I will review my question and see if it's worth keeping it. Thanks for your help @Adam. – David Mar 1 at 17:44
• ImplicitRegion[R, Evaluate@Array[s, 4]] – cvgmt Mar 2 at 0:18