Message Boards Message Boards

4 Replies
5 Total Likes
View groups...
Share this post:

Limit, Sqrt, and FullSimplify

Posted 10 years ago
f = (m - h)^2/(k^2 + m^2 - m*h) /. h -> Sqrt[k^2 + m^2];
g = FullSimplify[f];
lhs = FullSimplify[Limit[f, k -> 0]];
rhs = FullSimplify[Limit[g, k -> 0]];
thereisadifference = Not[lhs === rhs];
InputForm[{lhs, rhs, thereisadifference}]
On Mathematica (Linux x86), this last line gives:
{2, 1 - m/Sqrt[m^2], True}
A student of mine made an error in his problem set essentially because, in evaluating the limit of expression f as k approaches zero, he found lhs, whereas the problem in question required rhs (the correct answer). Could someone please explain to me the behavior of this code?
POSTED BY: Kiaran Dave
4 Replies
Posted 10 years ago
Ah, I see. From what you're telling me, the moral of the story is that for R a c. ring, P and Q prime ideals, the ideal P + Q need not be prime, so R/(P + Q) need not be an integral domain. In particular, there need not be a field of fractions Frac(R/(P+Q)), even though there is a ring (Frac(R/P))/Q. The issue here is then the equivocation of Frac(R/(P+Q)) and (Frac(R/P))/Q in symbolic manipulation.

Seems quite troublesome, indeed.
POSTED BY: Kiaran Dave
Limit will use Series and, in absence of assumptions, Series will not give generically correct results of algebraics or logs on branch cuts. The moral is: whenever possible, give assumptions on parameters that are sufficiently strong as to allow Series to give a viable expansion.

I'm not convinced that this is correctly phrased above in terms of fraction fields. Puiseux series seem like a better setting for this sort of thing.
POSTED BY: Daniel Lichtblau
This looks like another case of default branch cut selection producing unintuitive behavior.  Branch cuts are a major source of problems and confusion when doing computer algebra and calculus. If you look on this and other similar forums, you'll find a plethora of cases where branch cut handling has caused confusion.
Clear[f, g];
f[m_][k_] = (m - h)^2/(k^2 + m^2 - m*h) /. h -> Sqrt[k^2 + m^2];
g[m_][k_] = FullSimplify[f[m][k]];
"f" and "g" are still equal to each other (generically) as you would expect:
Reduce[f[m][k] == g[m][k]]
Solving the limit doesn't require using Limit itself. You can do the following:
FullSimplify[f[m][0], Assumptions -> Element[m, Reals]]
FullSimplify[g[m][0], Assumptions -> Element[m, Reals]]
These both essentially give the following, good answer:
1 - Sign[m]
Which you can verify experimentally:
Plot[{f[m][k], g[m][k]}, {k, -1, 1}, PlotRange -> {0, 2}], {m, -5, 5}]

So what is Limit doing?
The following isn't exactly what limit is doing, but it does demonstrate the fundamental issue with the choice of branch cuts. Let's look at the limit over the Numerator and Demoninator of f:
Limit[Numerator[f[m][k]], k -> 0]
2 m (m - Sqrt[m^2])
Limit[Denominator[f[m]], k -> 0]
m (m - Sqrt[m^2])

If you cancel m(m-Sqrt[m^2]) in both the numerator and denominator, you get 2. Mathematica will do that cancelation:
2 m (m - Sqrt[m^2])/ (m (m - Sqrt[m^2]))

You could argue that's not a safe cancelation to do. Sqrt[m^2] is really either +m or -m and it could be either, but Mathematica assumes that they both mean essentially the same thing. It's not that m was ever assumed to be positive, it's the confusion above with Sqrt having 2 possible values. Of course the algebra gets done as though it has one value.

If you'd like, you can forward the example to They can file it as an example for the developers to look at when they look into better ways to handle these kinds of symbolic issues.

How to avoid this problem
In this case, you can use Surd instead of Sqrt:
Clear[f, g];
f[m_][k_] = (m - h)^2/(k^2 + m^2 - m*h) /. h -> Surd[k^2 + m^2,2];
g[m_][k_] = FullSimplify[f[m][k]];
Unfortunately, this isn't a solution to all possible branch cut problems.  There isn't a clean way to handle them I'm afraid.
POSTED BY: Sean Clarke
This surely appears to be a bug.  It seems that the Limit of f is assuming that m>0.
 In[1]:= f = (m - h)^2/(k^2 + m^2 - m*h) /. h -> Sqrt[k^2 + m^2];
 In[2]:= Limit[f, k -> 0, Assumptions -> {m > 0}]
 Out[2]= 0
In[3]:= Limit[f, k -> 0, Assumptions -> {m < 0}]

Out[3]= 2

In[4]:= Limit[f, k -> 0, Assumptions -> {m \[Element] Reals}]

Out[4]= 2

You should report this to Wolfram support...
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract