# derivative of (x/Sqrt[x^2])

Posted 10 years ago
4536 Views
|
6 Replies
|
2 Total Likes
|
 When I ask Math for the derivative of x/(Sqrt[x^2])it returns ZERO.But one knows that the correct answer isDirac Delta .Can one explain why?
6 Replies
Sort By:
Posted 10 years ago
 You mean the derivative of Sqrt[x^2]/x, not x/Sqrt[x^2], right?As Marco said, mathematically this expression is undefined for x=0, and so is its derivative.However, Mathematica simply takes the formal derivative (which results in 0) and does not look at for what values of x the expression is not defined.  This is a rather common issue in Mathematica, but I think that trying to be completely precise in these cases would turn out to be counterproductive.Another example would be (2x-2)/(x-1).  This expression is equal to 2 for all x except for x=0 where it's undefined, hence its derivative should be undefined too.  But once again Simplify[(2x-2)/(x-1)] takes the practical route and gives 2, which is often the preferable result (although it's not strictly mathematically valid).  Simplify@D[(2x-2)/(x-1), x] is results 0 too.It is good to be aware of this behaviour: often the generic result returned by Mathematica is not valid in a one or a few points (usually similar cases to the above).
Posted 10 years ago
 Well, as long as we say that the derivative that Mathematica gives is correct in the entire domain of the original function, then that is consistent. Is your argument then, that the problem is that given only the derivative, we do not know its domain, i.e. the information regarding the domain of the original function regarding is lost in the derivative? I would agree that it would be nice to have an easier way of Mathematica giving me the domain of that derivative.However, there is some functionality in Wolfram Alpha which might be interesting here:WolframAlpha["domain of x/(Sqrt[x^2])", {{"Result", 1}, "Output"}](*HoldComplete[x < 0 || x > 0]*)It gives the domain of a function. It also tells me that the derivative is, in fact not defined at x=0:WolframAlpha["domain of Derivative[(x/(Sqrt[x^2])),x]", {{"Result",    1}, "Output"}] (*HoldComplete[x < 0 || x > 0]*)M.
Posted 10 years ago
 Are you sure about the Dirac Delta?The function you define (in the Reals?) is 1 everywhere apart from 0, where it is not defined. At that point (x=0) it is not defined, and hence has no derivative. I would think that Mathematica's answer that the derivative is 0 everywhere on its domain is quite correct.
Posted 10 years ago
 Small correction, -1 for x<0, 1 for x>0, undefined for x = 0.So derivative could be considered 2*DiracDelta ?  Since integrating over it produces 2*UnitStep + C ?
Posted 10 years ago
 Well, yes, I should have said that the magnitude is 1 everywhere, but the argument is true: f is not defined at x=0. The derivative is zero on the entire domain of f. I guess that that is what Mathemaitca wants to say.  I am aware that the delta distribution can be considered to be the derivative of the Heaviside function. http://mathworld.wolfram.com/DeltaFunction.htmlNote that the Heaviside function, defined as a piecewise constant function, is defined at x=0, so it is defined on the entire real line. (There is a way of defining as as a generalised function as well, which is a bit different.) BTW, I believe that Mathematica basically uses the piecewise constant function definition of the Heaviside function. http://mathworld.wolfram.com/HeavisideStepFunction.htmlThe derivative of the Heaviside function is indeed the Dirac Delta:D[HeavisideTheta[x], x](*DiracDelta[x]*)I think that Mathematica is just very cautious about distinguishing between x/(Sqrt[x^2])and D[2*HeavisideTheta[x] - 1, x](*2 DiracDelta[x]*)is indeed twice the DiracDelta. But they are not equal because of the domains. See also my post below. In other words there is no "jump" anywhere in its domain. It is a bit like with a function which is defined on the rationals such that it is 0 for all rationals < Sqrt and 1 for all rationals > Sqrt. Over the rationals that function is continuous in spite of the obvious jump at Sqrt. There is no point in the rationals where it actually is discontinuous. It's all a matter of the domains.M.
Posted 10 years ago
 Uh-Huh.  How to catch a Newbie.I guess I shouldn't have posted before actually examining the problem. I assume you've entered the derivative function incorrectly. In case you did enter your question incorrectly and are getting odd unexpected results in Mathematica and other people get the right answer for the same question, then the following tip might be useful. I had a "Flakey" problem with double integrals "acting incorrectly". I suggest you go to the URL provided  in my post (right below yours at the moment ) called "Double Integral Symbols don't work as advertised" and read it. It seems possible that your problem can be fixed in the same way mine was by resetting the Mathematica preferences to fix "common problems" (according to them). Read the whole URL or you may loose some stuff.