# Is Mathematica really getting this limit wrong?

Bug introduced in 5.1 and fixed in 10.0.2

I'm trying to calculate:

$$\lim_{\beta \to \infty} \tanh \left( \beta A \right) = \mathrm{sgn} \left( A \right)$$

for $A \in \mathbb{R}$, $\mathrm{sgn} \left( \# \right)$ being the sign function. The problem is that Mathematica evaluates the integral to something different:

In := Assuming[Element[A, Reals], Limit[Tanh[\[Beta]*A], \[Beta] -> Infinity]]
Out := 1


which is clearly not true for negative values of A.

Am I overlooking something really obvious? Is it a bug?

• Yes, Mathematica is really getting the limit wrong. It should be unevaluated. Will investigate. – Daniel Lichtblau May 13 '14 at 21:52
• Thank you very much Daniel. Just one additional question: why is everyone saying that the limit should go unevaluated? Isn't Sign[A] a correct result? – zakk May 14 '14 at 12:51
• Yes, Sign[A] would also be fine for this example. – Daniel Lichtblau May 14 '14 at 15:46

Like the example in the documentation Limit can return different values for this limit as follows:

Limit[Tanh[β*A], β -> ∞, Assumptions -> #] & /@ {A > 0, A == 0, A < 0}

{1, 0, -1}


When given a ∈ Reals the documentation example returns unevaluated:

Limit[x^a, x -> Infinity, Assumptions -> (a ∈ Reals)]

Limit[x^a, x -> ∞, Assumptions -> a ∈ Reals]


Therefore I suppose your example should also return unevaluated, but it does not.

• Indeed, if you make the modification Assuming[Element[A, Reals], Limit[TrigToExp[Tanh[β A]], β -> Infinity]] then the limit remains unevaluated, so this seems like a bug because the result for Tanh is wrong and moreover inconsistent with the result for TrigToExp@Tanh. – Jens May 13 '14 at 17:14
• Please note the occurrence of Removed[Failure] in Trace[Limit[x^a, x -> ∞, Assumptions -> a ∈ Reals],TraceInternal-> True]. Not sure what to make of that. – Jacob Akkerboom May 13 '14 at 17:23
• @Jacob Akkerboom It simply means Mathematica used some code written in Mathematica but intended only for internal use. Such code can, validly, return an internally understood failure expression to signal that it did not get a useful result. Mathematica does not let those escape, hence the Removed[]. In ordinary use it would never be visible (calling code catches it and handles appropriately), but it can appear in a trace. As it shows up only internal to Trace, I view it as "no harm, no foul". – Daniel Lichtblau May 13 '14 at 22:02

Fixed in 10.0.2. It now return unevaluated 