I need to be able to calculate an integral with this implicit region:
ImplicitRegion[
16 π^2 -
Sqrt[32 π^2 + Abs[Cos[θ1] r1]^2 +
Abs[r1 Sin[θ1]]^2] Sqrt[
Abs[Cos[θ1] r1]^2 +
Abs[Cos[φ1] r1 Sin[θ1]]^2 +
Abs[r1 Sin[φ1] Sin[θ1]]^2] + Cos[θ1]^2 r1^2 +
Cos[φ1] r1^2 Sin[θ1]^2 <= 0.5 &&
16 π^2 -
Sqrt[32 π^2 + Abs[Cos[θ1] r1]^2 +
Abs[r1 Sin[θ1]]^2] Sqrt[
Abs[Cos[θ1] r1]^2 +
Abs[Cos[φ1] r1 Sin[θ1]]^2 +
Abs[r1 Sin[φ1] Sin[θ1]]^2] + Cos[θ1]^2 r1^2 +
Cos[φ1] r1^2 Sin[θ1]^2 >= -0.5 &&
16 π^2 -
Abs[r2] Sqrt[32 π^2 + Abs[r2]^2 +
Abs[r1 Sin[φ1] Sin[θ1]]^2 +
Abs[r1 Sin[θ1] - Cos[φ1] r1 Sin[θ1]]^2] +
r2^2 <= 0.5 &&
16 π^2 -
Abs[r2] Sqrt[32 π^2 + Abs[r2]^2 +
Abs[r1 Sin[φ1] Sin[θ1]]^2 +
Abs[r1 Sin[θ1] - Cos[φ1] r1 Sin[θ1]]^2] +
r2^2 >= -0.5 && 160 <= r1 <= 300 && 160 <= r2 <= 300 &&
0 <= φ1 <= 2 π && 0 <= θ1 <= 2 π,
{r1, r2, φ1, θ1}]
I'm sorry if it's difficult to visualize, but I wouldn't know how to do it properly in a reasonable time here. Anyway, it's the same expression four times basically ( $f(\theta1,\phi1, r1,r2) \leq 0.5)$ and Mathematica tells me:
Unable to compute the dimension of region
and I don't understand what's wrong, apart from the fact that it might have problems because it's in 4D. How could I formulate it differently?
Edit
I managed to simplify it by making some assumptions:
ImplicitRegion[
-633.655 <=
r1 (r1 (4. + 1. θ1^4 - 2. θ1^2 ϕ1^2) -
Sqrt[(128 π^2 + r1^2 (4 + θ1^4)) (4 + θ1^4 + θ1^2 ϕ1^4)]) <=
-629.655 &&
314.827 + 2. r2^2 <=
r2 Sqrt[128 π^2 + 4 r2^2 + r1^2 θ1^2 ϕ1^2 (4 + ϕ1^2)] &&
r2 Sqrt[128 π^2 + 4 r2^2 + r1^2 θ1^2 ϕ1^2 (4 + ϕ1^2)] <=
316.827 + 2 r2^2 &&
r1 >= 0 && r2 >= 0 && 160 <= r1 <= 200 && 160 <= r2 <= 200 &&
-0.1 <= θ1 <= 0.1 && -0.1 <= ϕ1 <= 0.1,
{r1, r2, θ1, ϕ1}]
Now it doesn't give that error anymore, but instead it never finishes calculating.
Edit
I need to integrate a function over that region: NIntegrate[fn[r1, r2, θ1, ϕ1], {r1, r2, ϕ1, θ1} ∈ IntegrationZone, Method -> "MonteCarlo"] but what my problem is, is that NIntegrate[], or more precisely, Volume[], cannot calculate the area of that function. If I change the method to e.g. GlobalAdaptive, I get:
iCopyExpr() called on symbol.
so that's why I'm trying MonteCarlo.
Pi
instead of\pi
,` Sqrt[]` instead ofSqrt()
,theta1
instead oftheta_1
,phi1
instead ofphi_1
. If everything is fixed in the code, then an error occurs during numerical integration:DiscretizeRegion::cdim: The region given at position 1 in DiscretizeRegion[ImplicitRegion[...,{r1,r2,phi1,theta1}]] is in dimension 4. DiscretizeRegion only supports dimensions 1 through 3.
$\endgroup$