# Gaussian integral not converging

I have a large Gaussian integral to evaluate, and Mathematica claims it does not converge:

Res = Integrate[Integrate[ 1/(32 \[Pi]^5)(E^(-1.881097845541816Alpha1X^2 - 1.881097845541816 Alpha1Y^2-0.776219569108363 Alpha3X^2 - 0.776219569108363 Alpha3Y^2-1.6219812833697091 Alpha3X Alpha4X - 1.881097845541816 Alpha4X^2 +1.6219812833697087 Alpha3Y Alpha4Y - 1.8810978455418155 Alpha4Y^2 + 2.564577588805635 Alpha1Y AlphaUY - 0.7812669216517987 Alpha3Y AlphaUY + 2.293827928856761 Alpha4Y AlphaUY - 1.7429880609876338 AlphaUY^2 + 2.564577588805635 Alpha1X AlphaVX - 0.781266921651799 Alpha3X AlphaVX - 2.293827928856761 Alpha4X AlphaVX -1.7429880609876338 AlphaVX^2 - 2.564577588805635 Alpha1X xm +1.4792886705085173 Alpha3X xm + 2.9495448495343135 Alpha4X xm +3.4731279460398268 AlphaVX xm - 2.199924453259773 xm^2 -2.564577588805635 Alpha1Y ym + 1.479288670508518 Alpha3Y ym -2.9495448495343126 Alpha4Y ym + 3.4731279460398268 AlphaUY ym -2.1999244532597744 ym^2)), {Alpha3X, -\[Infinity], \[Infinity]},Assumptions -> {Im[xm] == 0,Im[ym] == 0}], {Alpha3Y, -\[Infinity], \[Infinity]}]


However, when I remove the sections of the exponent that are independent of the integration variable, it is able to converge to a value:

Res = 1/(32 \[Pi]^5)*Exp[-1.881097845541816 Alpha1X^2 - 1.881097845541816 Alpha1Y^2 - 1.881097845541816 Alpha4X^2 - 1.8810978455418155 Alpha4Y^2 + 2.564577588805635 Alpha1Y AlphaUY + 2.293827928856761 Alpha4Y AlphaUY - 1.7429880609876338 AlphaUY^2 + 2.564577588805635 Alpha1X AlphaVX - 2.293827928856761 Alpha4X AlphaVX - 1.7429880609876338 AlphaVX^2 - 2.564577588805635 Alpha1X xm + 2.9495448495343135 Alpha4X xm + 3.4731279460398268 AlphaVX xm - 2.199924453259773 xm^2 - 2.564577588805635 Alpha1Y ym - 2.9495448495343126 Alpha4Y ym + 3.4731279460398268 AlphaUY ym - 2.1999244532597744 ym^2]*Integrate[E^(-0.776219569108363 Alpha3X^2 - 0.776219569108363 Alpha3Y^2 - 1.6219812833697091 Alpha3X Alpha4X + 1.6219812833697087 Alpha3Y Alpha4Y - 0.7812669216517987 Alpha3Y AlphaUY - 0.781266921651799 Alpha3X AlphaVX + 1.4792886705085173 Alpha3X xm + 1.479288670508518 Alpha3Y ym), {Alpha3X, -\[Infinity],\[Infinity]}, {Alpha3Y, -\[Infinity], \[Infinity]}]

= 0.000413301 E^(-1.8811 Alpha1X^2 - 1.8811 Alpha1Y^2 - 1.03378 Alpha4X^2 - 1.03378 Alpha4Y^2 + 2.56458 Alpha1Y AlphaUY + 1.47756 Alpha4Y AlphaUY - 1.5464 AlphaUY^2 + 2.56458 Alpha1X AlphaVX - 1.47756 Alpha4X AlphaVX - 1.5464 AlphaVX^2 - 2.56458 Alpha1X xm + 1.40399 Alpha4X xm + 2.72867 AlphaVX xm - 1.49513 xm^2 - 2.56458 Alpha1Y ym - 1.40399 Alpha4Y ym + 2.72867 AlphaUY ym - 1.49513 ym^2)


A similar issue with a different integral happened on my desktop Mathematica version (13.3.1, Windows), and it was fixed by using the online cloud version (13.3.1, Linux), but now neither are able to converge. Sometimes the issue was fixed when I ran the line multiple times after each other, however that does not work now. When I tried this on an older version (12.2 Mac), it was able to do these.

Are there any additional assumptions I need to add to clarify this for the integral to evaluate? How come repeating the evaluation worked previously but doesn't now? Thanks in advance.

• Your first input has syntax error. Missing closing ). When I corrected it, it gives this answer on V 13.3.1 with no error !Mathematica graphics btw, you should be using non-exact numbers with Integrate. Could cause some problems sometimes. Commented Oct 7, 2023 at 5:35
• Ah sorry, that was a pasting error - correcting it still doesn't work on my versions output photos. Commented Oct 7, 2023 at 5:46
• Well, it works for me on windows 10, V 13.3.1. It could be version issue. !Mathematica graphics but again, try to rationalize the integrand so numbers are exact first, may be that will help on your version. Commented Oct 7, 2023 at 5:57

It works fine if you use assumptions properly: to declare that a variable has no imaginary part, assert that it is in the Reals. However, in the given example this assumptions makes no difference.

Assuming[Element[xm | ym, Reals],
1/(32 π^5) Exp[
-1.881097845541816 Alpha1X^2 - 1.881097845541816 Alpha1Y^2 -
0.776219569108363 Alpha3X^2 - 0.776219569108363 Alpha3Y^2 -
1.6219812833697091 Alpha3X Alpha4X - 1.881097845541816 Alpha4X^2 +
1.6219812833697087 Alpha3Y Alpha4Y - 1.8810978455418155 Alpha4Y^2 +
2.564577588805635 Alpha1Y AlphaUY - 0.7812669216517987 Alpha3Y AlphaUY +
2.293827928856761 Alpha4Y AlphaUY - 1.7429880609876338 AlphaUY^2 +
2.564577588805635 Alpha1X AlphaVX - 0.781266921651799 Alpha3X AlphaVX -
2.293827928856761 Alpha4X AlphaVX - 1.7429880609876338 AlphaVX^2 -
2.564577588805635 Alpha1X xm + 1.4792886705085173 Alpha3X xm +
2.9495448495343135 Alpha4X xm + 3.4731279460398268 AlphaVX xm -
2.199924453259773 xm^2 - 2.564577588805635 Alpha1Y ym +
1.479288670508518 Alpha3Y ym - 2.9495448495343126 Alpha4Y ym +
3.4731279460398268 AlphaUY ym - 2.1999244532597744 ym^2],
{Alpha3X, -∞, ∞}, {Alpha3Y, -∞, ∞}]]

(*    0.000413301 E^(-1.8811 Alpha1X^2 - 1.8811 Alpha1Y^2 -
1.03378 Alpha4X^2 - 1.03378 Alpha4Y^2 +
2.56458 Alpha1Y AlphaUY + 1.47756 Alpha4Y AlphaUY -
1.5464 AlphaUY^2 + 2.56458 Alpha1X AlphaVX -
1.47756 Alpha4X AlphaVX - 1.5464 AlphaVX^2 -
2.56458 Alpha1X xm + 1.40399 Alpha4X xm +
2.72867 AlphaVX xm - 1.49513 xm^2 -
2.56458 Alpha1Y ym - 1.40399 Alpha4Y ym +
2.72867 AlphaUY ym - 1.49513 ym^2)                    *)


Mathematica is becoming more exact and more complicated to use with each version.

Gaussian integrals with symbols do not converge, except the real part of the square in the exponent is positive, such that $$\Re a >0 \longrightarrow \lim_{x\to \pm \infty} e^{- a x ^2 + \text{linear terms}} =0$$

    Res = Res/. Integrate :>Inactive[Integrate]


gather the symbols

 smb = Cases[Res, Except[ E | \[Pi], _Symbol], \[Infinity]] // Union;


and integrate with all symbols restricted to reals

Assuming[smb \[Element] Reals, Activate[Res]]


\begin{align}&0.000413301\\& * \ \exp(-1.8811 Alpha1X^2 - 1.8811 Alpha1Y^2 \\&- 1.03378 \ Alpha4X^2 - 1.03378 \ Alpha4Y^2 + 2.56458 \ Alpha1Y\ AlphaUY \\&+ 1.47756 \ Alpha4Y \ AlphaUY - 1.5464 \ AlphaUY^2 + 2.56458 \ Alpha1X \ AlphaVX - 1.47756 \ Alpha4X \ AlphaVX \\&- 1.5464 \ AlphaVX^2 - 2.56458 \ Alpha1X \ xm + 1.40399 \ Alpha4X\ xm \\&+ 2.72867 \ AlphaVX \ xm - 1.49513 \ xm^2 - 2.56458 \ Alpha1Y \ ym - 1.40399 \ Alpha4Y \ ym + 2.72867 \ AlphaUY \ ym - 1.49513 \ ym^2) \end{align}

A shortcut for such problems is

 Assuming[ _ \[Element] Reals, Res ]


Mathematica v12.2. evaluates without any assumptions:

 Integrate[
1/(32 \[Pi]^5) (E^(-1.881097845541816 Alpha1X^2 -
1.881097845541816 Alpha1Y^2 - 0.776219569108363 Alpha3X^2 -
0.776219569108363 Alpha3Y^2 -
1.6219812833697091 Alpha3X Alpha4X -
1.881097845541816 Alpha4X^2 +
1.6219812833697087 Alpha3Y Alpha4Y -
1.8810978455418155 Alpha4Y^2 +
2.564577588805635 Alpha1Y AlphaUY -
0.7812669216517987 Alpha3Y AlphaUY +
2.293827928856761 Alpha4Y AlphaUY -
1.7429880609876338 AlphaUY^2 +
2.564577588805635 Alpha1X AlphaVX -
0.781266921651799 Alpha3X AlphaVX -
2.293827928856761 Alpha4X AlphaVX -
1.7429880609876338 AlphaVX^2 - 2.564577588805635 Alpha1X xm +
1.4792886705085173 Alpha3X xm +
2.9495448495343135 Alpha4X xm +
3.4731279460398268 AlphaVX xm - 2.199924453259773 xm^2 -
2.564577588805635 Alpha1Y ym + 1.479288670508518 Alpha3Y ym -
2.9495448495343126 Alpha4Y ym +
3.4731279460398268 AlphaUY ym -
2.1999244532597744 ym^2)), {Alpha3X, -\[Infinity], \
\[Infinity]}, {Alpha3Y, -\[Infinity], \[Infinity]}]

(* 0.000413301 E^(-1.8811 Alpha1X^2 - 1.8811 Alpha1Y^2 -
1.03378 Alpha4X^2 - 1.03378 Alpha4Y^2 + 2.56458 Alpha1Y AlphaUY +
1.47756 Alpha4Y AlphaUY - 1.5464 AlphaUY^2 +
2.56458 Alpha1X AlphaVX - 1.47756 Alpha4X AlphaVX -
1.5464 AlphaVX^2 - 2.56458 Alpha1X xm + 1.40399 Alpha4X xm +
2.72867 AlphaVX xm - 1.49513 xm^2 - 2.56458 Alpha1Y ym -
1.40399 Alpha4Y ym + 2.72867 AlphaUY ym - 1.49513 ym^2)*)