In order to calculate the volume of the solid defined by
$$\frac{51}{100} (\cos x \cos y+\cos x \cos z+\cos y \cos z)+\cos x+\cos y+\cos z+1\le0$$
where $x,y,z\in[0,2\pi]$
I used the following code (in MATLAB)
f = @(x, y, z) double(1 + cos(x) + cos(y) + cos(z) + 0.51*(cos(x).*cos(y) + cos(x).*cos(z) + cos(y).*cos(z))<=0)
q = 8*integral3(f, 0, pi, 0, pi, 0, pi)
but gives warning message and NaN
:
Warning: Reached the maximum number of function evaluations (10000). The result fails the global error test.
How to obtain the desired result in as high as possible precision?
Update:
It seems Gauss-Kronrod Rule solves this problem correctly; a further variable substitution, $u_i=\cos x_i$ with Jacobian determinant involved may cause computation efficiency.