Why the first is evaluated while the second is not (Sum behaves differently from Integrate)?

RegIntegral[Integrate[e_, {t_, 0, Infinity}]] := 5
RegSum[Sum[e_, {t_, 0, Infinity}]] := 5

RegIntegral[Integrate[Exp[3 x], {x, 0, Infinity}]]
RegSum[Sum[Exp[3 x], {x, 0, Infinity}]]


The only difference is in the first case we use sum, in the second case, integral. The tech support said it works as it should, and in the secnd case I get infinite loop.

I think, it is a bug.

• Please write an informative title. Yours says nothing about the content of your question. Aug 25, 2023 at 18:57

Note that Sum has the attribute HoldAll, while Integrate does not. This means that the definition of RegSum has Infinity and not what Infinity evaluates to. The evaluation of Infinity:

Infinity //FullForm


DirectedInfinity[1]

DownValues[RegSum] //FullForm


List[RuleDelayed[HoldPattern[RegSum[Sum[Pattern[e,Blank[]],List[Pattern[t,Blank[]],0,Infinity]]]],5]]

Note the presence of Infinity.

When Sum evaluates and realizes that it does not converge, it returns a Sum expression where Infinity has been replaced with DirectedInfinity[1]:

Sum[Exp[3 x], {x, 0, Infinity}] //FullForm


Sum::div: Sum does not converge.

Sum[Power[E,Times[3,x]],List[x,0,DirectedInfinity[1]]]

This means that your definition, which is expecting Infinity doesn't fire because the upper limit is instead DirectedInfinity[1].

A possible workaround is to use:

RegSum[Sum[e_,{t_,0,DirectedInfinity[1]}]]:=5

• I absolutely do not understand your explanation, but it works! Aug 25, 2023 at 19:48