Update: From the following notebook files, one can check that this discrepancy is not there in mathematica 13.1, while it is there in 14.0.0. Bug in 14.0? Did it get resolved in the more recent versions?
Original Question:
I'm observing a discrepancy in Mathematica 14.0.0 (Linux) where Limit applied to a sum gives a different result than summing the limits of the terms.
Given a large symbolic expression $T(t)$ (defined in the linked notebook) which is a sum of terms.
Calculating the limit as $t \to \infty$ in two ways yields different results:
(* Method 1: Limit of the sum *) limitOfSum = Limit[T, {t -> Infinity}]; (* Method 2: Sum of limits of terms *) TList = Apply[List, T]; (* Verified T == Total[TList] *) sumOfLimits = Total[Map[Limit[#, {t -> Infinity}] &, TList]]; (* The difference is non-zero *) difference = Simplify[limitOfSum - sumOfLimits]; The calculated difference is finite.
The limit of the sum part of the calculation takes 50 minutes (i7 12th gen processor), although all the output generated is also available in the notebook for quick verification. Rest of the calculation is quick. The full notebook with the definition of T and the code is available here:
Questions:
- Why does this discrepancy occur?
- Is this expected behavior or a potential bug in
Limit? - Which result is likely correct?
Some quick clarifications. You can verify from the code:
- The sum of limit is convergent for each term and so is the Limit of the sum.
- The expression has simple trigonometric, hyperbolic and exponential functions only.
- There are total 114 terms. I have ran some obvious bug tests before posting here. See my answer for more details.