I was trying to calculate the following limit:

$$ \lim_{(x,y)\to (0,0)} \frac{(x^2+y^2)^2}{x^2+y^4} $$

and, feeding it into WolframAlpha, I obtain the following answer, stating the limit is $0$: enter image description here

However, when I try to calculate the limit when $x = 0$ and $y$ approaches 0, the limit is 1...

Is the answer given by WolframAlpha wrong? or am I?

  • 9
    $\begingroup$ "they are so limited": are you kidding ? $\endgroup$ – user65203 Mar 9 '17 at 12:58
  • 12
    $\begingroup$ @YvesDaoust I think the correct phrasing should be "They are not magic, and using them without knowing the underlying assumptions or caveats that come with them is likely to cause you some issue in specific scenarii." Computer algebra systems don't fool people. People fool people. $\endgroup$ – Clement C. Mar 9 '17 at 13:00
  • 12
    $\begingroup$ @ClementC.: IMO very mature CAS such as Mathematica are more reliable than the average mathematician, not counting their ability to perform bulky computations without getting tired. They embed large mathematical culture. (But I also fully agree with your comment.) $\endgroup$ – user65203 Mar 9 '17 at 13:07
  • 5
    $\begingroup$ @ClementC.: from the Mathematica documentation, I cannot guess if two-variables limits are supported at all. But if that wasn't the case, I would expect at least a warning message... $\endgroup$ – user65203 Mar 9 '17 at 14:52
  • 3
    $\begingroup$ @YvesDaoust From what I gather from this thread, Mathematica (implicitly) does limits sequentially. So that it does not produce any message, but only gives the right answer when the limit is path-independent. $\endgroup$ – Clement C. Mar 9 '17 at 15:46

This limit is an excellent example to illustrate the power of the (two-)path test and apparently also an excellent example to see that you have to be very careful with how mathematical software deals with this type of problems.

However, when I try to calculate the limit when x = 0 and y approaches 0, the limit is 1...

I the Wolfram wrong ? or am I ?

You are right since, as you say: $$\lim_{x \to 0} \left( \lim_{y \to 0} \frac{\left(x^2+y^2\right)^2}{x^2+y^4} \right) =\lim_{x \to 0} x^2 =0 \quad \color{red}{\ne} \quad \lim_{y \to 0} \left( \lim_{x \to 0} \frac{\left(x^2+y^2\right)^2}{x^2+y^4} \right) =\lim_{y \to 0} \frac{y^4}{y^4} =1$$

WolframpAlpha does produce a decent plot where you can clearly see the parabola $x^2$ when you set $y=0$, but you can also see the 'line' at height $1$ when you set $x=0$.

enter image description here


This is only to complement the excellent answer of StackTD, who correctly shows that you are right — the limit does not exist (as one can find two different paths to the origin along which the limits of the function differ). The key message is:

Do not try limits in more than one variable with Mathematica or WolframAlpha.

(actually, I'd go further and suggest: Do not try limits in more than one real variable with Mathematica or WolframAlpha.)

See e.g. this thread on Mathematica.SE which goes at length into explaining one can possibly try and do it -- spoiler, it's complicated. Quoting a comment from there, by Jens:

With Limit, you're always restricted to a line in the larger space, and you can't make statements about the existence of the limit in the sense of the higher-dimensional space. For that you have to show the independence of the result on the direction of the line. If you intentionally set up a function to have different limits along different lines, I dont (sic) see what else you can do with Mathematica.

  • 4
    $\begingroup$ One may add that there are functions for which the limit at a point does not exist, even though the limits along every straight line through that point exist, and they all agree. $\endgroup$ – Marc van Leeuwen Mar 10 '17 at 8:03
  • $\begingroup$ @MarcvanLeeuwen Can it happen even if we require that $f$ is defined and continuous on a punctured disk around $(0,0)$? That is, if $f:\{ (x,y)\in\mathbb{R}^2 \mid 0 < x^2+y^2 < \epsilon^2\} \to \mathbb{R}$ is continuous, can it happen that all limits along straight lines tending towards $(0,0)$ exist and agree, and still the 2-dimensional limit does not exist? $\endgroup$ – Jeppe Stig Nielsen Mar 10 '17 at 14:08
  • 1
    $\begingroup$ @JeppeStigNielsen Yes, try $\def\R{\Bbb R}f:\R^2\to\R$ defined by $f(x,y)=g(\frac y{x^2})$ for $x\neq0$ and $f(0,y)=0$, where $g:t\mapsto t\exp(-t^2)$ is a function that goes to$~0$ for $t=0$ and $t\to\pm\infty$. $\endgroup$ – Marc van Leeuwen Mar 10 '17 at 15:55
  • 2
    $\begingroup$ I might also mention the answer by Dan Lichtblau, since he happens to be the developer who wrote most of the Mathematica code that WolframAlpha uses to do this type of computation. $\endgroup$ – Mark McClure Mar 10 '17 at 16:46
  • $\begingroup$ To the downvoter: care to explain why? $\endgroup$ – Clement C. Mar 11 '17 at 15:13

Wolfram Alpha correctly evaluates

$$ \lim_{x\to0}\lim_{y\to0} \frac{(x^2+y^2)^2}{x^2+y^4}= 0 $$


$$ \lim_{y\to0}\lim_{x\to0} \frac{(x^2+y^2)^2}{x^2+y^4}= 1. $$

So one should question the meaning of a limit entered as $(x,y)\to(0,0)$.

  • 10
    $\begingroup$ A.k.a. "nowhere in the documentation is written that The limits are not evaluated sequentially, since the documentation of Mathematica only mentions single-variable limits." $\endgroup$ – Clement C. Mar 9 '17 at 16:23

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.