# Integrating absolute value of a function

I have a symmetric spherical function, which I want to integrate to determine the volume enclosed. Since it is symmetric, simple integration after multiplying with Sin[theta] gives zero. I also tried integrating the absolute value of functions by using Abs[], but it also does not seem to work. Following is example.

X = 4000*Cos[\[Theta]] Sin[\[Theta]]^2 +
1300*Cos[\[Phi]] Sin[\[Theta]]^3 (Cos[\[Phi]]^2 -
3 Sin[\[Phi]]^2) + 200*Cos[\[Theta]]^3;

Integrate[X*Sin[\[Theta]], {\[Theta], 0, Pi}, {\[Phi], 0, 2Pi}]
Integrate[Abs[X]*Sin[\[Theta]], {\[Theta], 0, Pi}, {\[Phi], 0, 2Pi}]


Will be thankful for any suggestion.

• I want to find out the volume enclosed by the surface X – user49535 Nov 11 '19 at 13:08

Let's first see what the surface we have:

SphericalPlot3D[X, {θ, 0, π}, {ϕ, 0, 2 π}]


Roughly it looks like 3 ellipsoids, we can estimate a volume (by free rotation one can get values of semi-axes):

4/3 π 700 700 1000 3. = 6.15752*10^9.


For more accurate integration we need to know ranges of θ and ϕ, where X >= 0 (X is radius as function of θ and ϕ):

R = ImplicitRegion[X >= 0, {{θ, 0, π}, {ϕ, 0, 2 π}}]
Region[R, Frame -> True, FrameLabel -> {θ, ϕ}]


The volume enclosed by function r(θ, ϕ) in spherical coordinates can be calculated as (see e.g. here, equation (13)):

(1/3) NIntegrate[X^3 Sin[θ], {θ, ϕ} ∈ R] = 5.99868*10^9,


which is very close to rough estimation from 3D picture.