# How to make this kind of integration with the trigonometric function?

I am trying to make the following integration. But I am not sure about the result obtained as follows.

Is there some way to get more reliable and accurate results?

Thanks.

NIntegrate[
(x1 x2 x3)/((1 + x1^2)^(3/2) (1 + x3^2)^(3/2) (1 + x2^2 - 7 x2 Cos[x4]) Sqrt[x1^2 + x2^2 - x1 x2 Cos[x5]] Sqrt[ 1 + 9 (x1^2 + x2^2 - x1 x2 Cos[x6])])
, {x1, 0, ∞}
, {x2, 0, ∞}
, {x3, 0, ∞}
, {x4, 0, 2 π}
, {x5, 0, 2 π}
, {x6, 0, 2 π}
]


Edit:

To avoid the singularity problem, I revise the above problem and make the integral as follows,

        fexp = (x1 x2 x3)/((1 + x1^2)^(3/2) (1 + x3^2)^(
3/2) (1 + x2^2 - x2 Cos[x4]) Sqrt[
3 + x1^2 + x2^2 - 2 x1 x2 Cos[x5]] Sqrt[
1 + x1^2 + x2^2/4 - x1 x2 Cos[x6]]);

NIntegrate[fexp
, {x1, 0, ∞}
, {x2, 0, ∞}
, {x3, 0, ∞}
, {x4, 0, 2 π}
, {x5, 0, 2 π}
, {x6, 0, 2 π}]

Out=75.0157  (with warning messages, Numerical integration converging
too slowly; .... )


In addition, I want to get the results numerically by taking some proper algorithms. Of course, we can check the results analytically (partly).

• The integrand has a singularity 1 + x2^2 - 7 x2 Cos[x4] == 0 in x2 and x4. I have strong doubts about the convergence of the improper integral under consideration. Jul 7, 2022 at 13:33
• I think this kind of singularity is not so serious in integrations. The difficult part is from the oscillation and multi-dimensional integral. Jul 7, 2022 at 13:48
• 1 + x2^2 - 7 x2 Cos[x4] ==(x2 - 1/2 (7 Cos[x4] - Sqrt[41 + 49 Cos[2 x4]]/Sqrt)*(x2 - 1/2 (7 Cos[x4] + Sqrt[41 + 49 Cos[2 x4]]/Sqrt). Wee see non- integrable singularities at x2 ==-1/2 (7 Cos[x4] - Sqrt[41 + 49 Cos[2 x4]]/Sqrt and x2 == 1/2 (7 Cos[x4] - Sqrt[41 + 49 Cos[2 x4]]/Sqrt in x2. Don't hesitate to ask for further explanation in need. Jul 7, 2022 at 13:59
• @user64494 Thanks. Now, I think we cannot neglect singularity. But, that's not the intent of the question. I revise the questions. Jul 12, 2022 at 2:24

You can do most of the inegrations analyticlly. As the other comments mention, you have to consider singularities.

f = (x1 x2 x3)/((1 + x1^2)^(3/2) (1 + x3^2)^(3/2) (1 + x2^2 -
7 x2 Cos[x4]) Sqrt[x1^2 + x2^2 - x1 x2 Cos[x5]] Sqrt[
1 + 9 (x1^2 + x2^2 - x1 x2 Cos[x6])]) // Together;

int21 = Integrate[f, {x5, 0, 2 \[Pi]}, {x6, 0, 2 \[Pi]},
Assumptions -> {x1 > 0, x2 > 0, x3 > 0, 0 < x4 < 2 Pi}]

(*   (16 x1 x2 x3 EllipticK[-((2 x1 x2)/(
x1^2 - x1 x2 + x2^2))] EllipticK[-((18 x1 x2)/(
1 + 9 (x1^2 - x1 x2 + x2^2)))])/(Sqrt[(x1^2 - x1 x2 + x2^2) (1 +
9 (x1^2 - x1 x2 + x2^2))] ((1 + x1^2) (1 + x3^2))^(
3/2) (1 + x2^2 - 7 x2 Cos[x4]))   *)

int22 = Integrate[int21, {x3, 0, Infinity},
Assumptions -> {x1 > 0, x2 > 0, x3 > 0, 0 < x4 < 2 Pi}]

(*   (16 x1 x2 EllipticK[-((2 x1 x2)/(x1^2 - x1 x2 + x2^2))] EllipticK[-((
18 x1 x2)/(1 + 9 (x1^2 - x1 x2 + x2^2)))])/((1 + x1^2)^(
3/2) Sqrt[(x1^2 - x1 x2 + x2^2) (1 + 9 (x1^2 - x1 x2 + x2^2))] (1 +
x2^2 - 7 x2 Cos[x4]))   *)


Singularities at

ContourPlot[(1 + x2^2 - 7 x2 Cos[x4]) == 0, {x2, 0, 10}, {x4, 0,
2 Pi}]


In this range, integral is zero.

int23 = Integrate[int22, {x4, 0, 2 Pi},
Assumptions -> x1 > 0 && x2 > 0, PrincipalValue -> True]

(*   ConditionalExpression[0,
3 Sqrt + 2 x2 >= 7 && 2 x2 <= 7 + 3 Sqrt]   *)

{red = Reduce[int23[], x2], red // N}

(*   {1/2 (7 - 3 Sqrt) <= x2 <= 1/2 (7 + 3 Sqrt),
0.145898 <= x2 <= 6.8541}   *)

int24 = Integrate[int22, {x4, 0, 2 Pi},
Assumptions ->
x1 > 0 && (0 < x2 < 1/2 (7 - 3 Sqrt) ||
1/2 (7 + 3 Sqrt) < x2)]

(*   (32 \[Pi] x1 x2 EllipticK[-((2 x1 x2)/(
x1^2 - x1 x2 + x2^2))] EllipticK[-((18 x1 x2)/(
1 + 9 (x1^2 - x1 x2 + x2^2)))])/((1 + x1^2)^(
3/2) Sqrt[(x1^2 - x1 x2 + x2^2) (1 - 47 x2^2 + x2^4) (1 +
9 (x1^2 - x1 x2 + x2^2))])   *)

int25 = NIntegrate[
int24, {x1, 0, Infinity}, {x2, 0, 1/2 (7 - 3 Sqrt)},
WorkingPrecision -> 15] +
NIntegrate[
int24, {x1, 0, Infinity}, {x2, 1/2 (7 + 3 Sqrt), Infinity},
WorkingPrecision -> 15]

(*   3.820016280311350   *)


Edit

What i did with int23, is regarding x1 and x2 as parameters and calculating the principal value for x4. This is affirmed by inserting parameters.

ii22[x1_, x2_, x4_] = int22; Manipulate[
Plot[ii22[x1, x2, x4], {x4, 0, 2 Pi}, PlotPoints -> 50,
PlotRange -> 5], {{x1, 2}, 0, 10,
Appearance -> "Labeled"}, {{x2, 1/E}, 0, 10,
Appearance -> "Labeled"}] int23b = Integrate[int22 /. {x2 -> 1/E}, {x4, 0, 2 Pi},
PrincipalValue -> True, Assumptions -> x1 > 0]

(*   0   *)

Reduce[0 < x4 < 2 Pi && 0 == (1 + x2^2 - 7 x2 Cos[x4]) /.
x2 -> 1/E, x4, Reals]

(*   x4 == 2 \[Pi] - ArcCos[(1 + E^2)/(7 E)] ||
x4 == ArcCos[(1 + E^2)/(7 E)]   *)

NIntegrate[
int22 /. {x1 -> 2, x2 -> 1/E}, {x4, 0, ArcCos[(1 + E^2)/(7 E)],
2 Pi - ArcCos[(1 + E^2)/(7 E)], 2 Pi}, Method -> "PrincipalValue"]

(*   3.71023*10^-14   *)


I'm no pure mathematician to be able to proof this kind of proceeding. But otherwise you must state, integral is not integrable.

• I have never seen the notion of principal value for multiple integrals. In fact, int23 is an iterated integral where the outer integral is treated as the principal value. I repeat, the double improper integral under consideration diverges and NIntegrate of the integrand under consideration bears witness to this, reporting of a possible singularity. Jul 7, 2022 at 15:11
• See here and here for info. Jul 8, 2022 at 5:53
• Can you kindly explain what you mean by "integral is not integrable"? TIA. Jul 8, 2022 at 5:55
• Example: Suppose $B \subset \mathbb{R}^2$ is the ball with radius 2 centered at the origin, set $f(x,y)=\frac{1}{x^2+y^2-1}$. Is $\int_Bf(x,y)dxdy$ defined? Clearly $\int_B |f(x,y)| dx dy$ is infinite. But using polar coordinates $x+iy=re^{i\varphi}$ (and using $dxdy = r dr d\varphi$ as a recipe, no theorem) and using PrincipalValue->True for the $r$-integral yields the result $\pi\log 3$. Is this a meaningful number? Can the notion of the integral be extended, with good properties, to such functions $f$? Cf. this 6-year-old post. Jul 8, 2022 at 6:49
• @user293787: Thank you for the link. As far as I understand it, that is an invention of Dr. Wolfgang Hintze only. The convergence of an improper integral should not depend on an exhaustion of the domain of the integration and coordinates (see G.H. Hardy, "A course of pure mathematics" , Cambridge Univ. Press (1975) for info.). Thank you anyway. Jul 8, 2022 at 8:03