1
$\begingroup$

I am not very used to do numerical simulations on Mathematica. I have a problem with numerical integration of this function. Is there any way for this calculation?

Input:

α := 0.07

A := Sin[θ]*Sin[θ2]*Cos[φ - φ2] + Cos[θ]*Cos[θ2]
B := Sin[θ]*Sin[θ3]*Cos[φ - φ3] + Cos[θ]*Cos[θ3]
V := Sin[θ2]*Sin[θ3]*Cos[φ2 - φ3] + Cos[θ2]*Cos[θ3]

c2 := (B*c*c3 - c3*c3)/(A*c - c3*V)

integrand := 
 1/2 1/((-1 + E^(c^2 - α)) (-1 + E^(c2^2 - α)) Abs[A c - c3 V]) 
 c^4 c2^2 c3^2 (1 + 1/(-1 + E^(c^2 - α))) (1 + 1/(-1 + E^(c3^2 - α)))
 (1 + 1/(-1 + E^(c^2 + 2 A c c2 + c2^2 - B c c3 + c3^2 - 2 c2 c3 V - α))) 
 (1 + 3 Cos[2 θ]) (c Cos[θ] - c3 Cos[θ3])
 (c2 Cos[θ2] - c3 Cos[θ3]) Sin[θ] Sin[θ2] Sin[θ3]

NIntegrate[integrand, 
    {c3, 0, ∞}, {θ3, 0, π}, {θ2, 0, π}, 
    {φ3, 0, 2 π}, {φ2, 0, 2 π}, {c, 0, ∞}, {θ, 0, π}, {φ, 0, 2 π}, 
    Method -> "MultiDimensional"]

Output:

    NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the
 following: singularity, value of the integration is 0, highly oscillatory integrand, or
 WorkingPrecision too small. >>

    NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more
 than 2000 times. The global error is expected to decrease monotonically after a number of
 integrand evaluations. Suspect one of the following: the working precision is insufficient
 for the specified precision goal; the integrand is highly oscillatory or it is not a 
(piecewise) smooth function; or the true value of the integral is 0. Increasing the value of
 the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical 
integration. NIntegrate obtained -27257.8 and 652260.228217954` for the integral and error
 estimates. >>

I am using Mathematica 8.0

$\endgroup$
1
  • 1
    $\begingroup$ In Mathematica 9.0.1 I get -49639.1345 with no errors. The only thing I did differently was use Set(=) instead of SetDelayed(:=) to define the variables. $\endgroup$
    – RunnyKine
    Mar 22, 2014 at 15:01

1 Answer 1

1
$\begingroup$

I can confirm that using SetDelayed instead of Set is the culprit here. As I get the same error you got with SetDelayed but not with Set

The following works fine:

α = 0.07;
A = Sin[θ]*Sin[θ2]*Cos[φ - φ2] + Cos[θ]*Cos[θ2];
B = Sin[θ]*Sin[θ3]*Cos[φ - φ3] + Cos[θ]*Cos[θ3];
V = Sin[θ2]*Sin[θ3]*Cos[φ2 - φ3] + Cos[θ2]*Cos[θ3];
c2 = (B*c*c3 - c3*c3)/(A*c - c3*V);

integrand = 1/2 1/((-1 + E^(c^2 - α)) (-1 + E^(c2^2 - α)) Abs[A c - c3 V]) 
 c^4 c2^2 c3^2 (1 + 1/(-1 + E^(c^2 - α))) (1 + 1/(-1 + E^(c3^2 - α)))
 (1 + 1/(-1 + E^(c^2 + 2 A c c2 + c2^2 - B c c3 + c3^2 - 2 c2 c3 V - α))) 
 (1 + 3 Cos[2 θ]) (c Cos[θ] - c3 Cos[θ3])
 (c2 Cos[θ2] - c3 Cos[θ3]) Sin[θ] Sin[θ2] Sin[θ3];

NIntegrate[integrand, {c3, 0, ∞}, {θ3, 0, π}, {θ2, 0, π}, 
    {φ3, 0, 2 π}, {φ2, 0, 2 π}, {c, 0, ∞}, {θ, 0, π}, {φ, 0, 2 π}, 
    Method -> "MultiDimensional"]

This gives:

-49639.1345

Note This is on Mathematica 9.0.1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.