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[1] := Assuming[Element[A, Reals], Limit[Tanh[\[Beta]*A], \[Beta] -> Infinity]]
Out[1] := 1

which is clearly not true for negative values of A.

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

  • 9
    $\begingroup$ Yes, Mathematica is really getting the limit wrong. It should be unevaluated. Will investigate. $\endgroup$ – Daniel Lichtblau May 13 '14 at 21:52
  • $\begingroup$ 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? $\endgroup$ – zakk May 14 '14 at 12:51
  • $\begingroup$ Yes, Sign[A] would also be fine for this example. $\endgroup$ – 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.

  • 3
    $\begingroup$ 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. $\endgroup$ – Jens May 13 '14 at 17:14
  • $\begingroup$ 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. $\endgroup$ – Jacob Akkerboom May 13 '14 at 17:23
  • 7
    $\begingroup$ @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". $\endgroup$ – Daniel Lichtblau May 13 '14 at 22:02

Fixed in 10.0.2. It now return unevaluated

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.