# Apparent contradiction in double summation

I have two expressions which, if my maths is correct, should both be true. But Mathematica doesn't agree. I can take the expression E^(-n^3) out of the single summation, but not out of the double summation...

TrueQ[Sum[a*E^(a - n^3), {a, 1, n}]/E^n ==
E^(-n^3 - n)*Sum[a*E^a, {a, 1, n}]]
*True*

TrueQ[Sum[a*b*E^(a*b - n^3), {a, 1, n},
{b, 1, n}]/E^n == E^(-n^3 - n)*
Sum[a*b*E^(a*b), {a, 1, n}, {b, 1, n}]]
*False*


...but E^(-n^3) is not dependent on a or b, so surely it can be moved outside of the summation in both cases.

Is my maths wrong, or is Mathematica? And if Mathematica, can it be fixed or worked around?

TrueQ will return True only if the input is explicitly True. You can use TrueQ to "assume" that a test fails (i.e., is False) when its outcome is not clear. It is generally not used to test if mathematical expressions are equivalent (Equal) since some form of simplification or transformation is often required to obtain a result which is explicitly True.

TrueQ worked in your first example since the expression is explicitly True

Sum[a*E^(a - n^3), {a, 1, n}]/E^n == E^(-n^3 - n)*Sum[a*E^a, {a, 1, n}]

(* True *)


However, in the second example, the expression is not explicitly True

Sum[a*b*E^(a*b - n^3), {a, 1, n}, {b, 1, n}]/E^n ==
E^(-n^3 - n)*Sum[a*b*E^(a*b), {a, 1, n}, {b, 1, n}]


Simplifying this expression is not straightforward; however, it can be readily verified for specific values of n.

Manipulate[
Simplify[Sum[a*b*E^(a*b - n^3), {a, 1, n}, {b, 1, n}]/E^n ==
E^(-n^3 - n)*Sum[a*b*E^(a*b), {a, 1, n}, {b, 1, n}]],
{{n, 10}, Range[10, 50, 10], ControlType -> SetterBar}]


This is a known feature of Mathematica. See for example, question 199454 "Problem with extracting a constant multiplier out of sum" and the answers given there. The fundamental problem is that there is only a limited amount of simplifications that Mathematica or any other Computer Algebra System can do automatically. Some simplifications that we can see immediately may not be so easy to implement. Choices have to be made. That is why, for example, Mathematica has Simplify as well as FullSimplify. In the case of the question mentioned earlier, a partial workaround was possible. You could do something similar here, but it is not really worth it in general. You can always use ad hoc algebraic expression manipulations to do what you want, but Mathematica will not do them automatically.