Timeline for Strange behaviour of MMA in derivatives of some standard functions
Current License: CC BY-SA 3.0
22 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Sep 17, 2014 at 7:10 | comment | added | Dr. Wolfgang Hintze | @ Jens: in order to find this out it might help to have a brief look at the fairly extensive comments here which are, as it were, kind of a "scattered" answer. I'm now fine with it. | |
Sep 15, 2014 at 22:34 | comment | added | Jens | I tried to figure out what the question is about, but I honestly can't think of any way to answer here. | |
Sep 15, 2014 at 18:05 | history | tweeted | twitter.com/#!/StackMma/status/511576640791781376 | ||
Sep 15, 2014 at 13:10 | history | edited | Dr. Wolfgang Hintze | CC BY-SA 3.0 |
Provide links to the references
|
Sep 13, 2014 at 16:43 | comment | added | Dr. Wolfgang Hintze | I have studied the documentation for all these discontinous functions and shall present an overview as an edit to my question, as soon as I find the time. Here's just one positive example: "Possible issues for Conjugate: Differentiating Conjugate is not possible: D[Conjugate[t], t] -> Derivative[1][Conjugate][t]". I think this should be mentioned with Abs too. | |
Sep 13, 2014 at 14:27 | comment | added | Michael E2 |
Here's another way to look at it: In cases where the complex and real derivative have the same formula, you should find that D returns the expected result. In cases where the complex and real derivatives do not agree, the Derivative should be undefined.
|
|
Sep 13, 2014 at 14:25 | comment | added | Michael E2 |
@Dr.WolfgangHintze, Yes, D[Abs[z], z] is permitted. I believe one can take D of almost anything (early example: D[Plot[Sin[x], {x, 0, 2 Pi}]^2, Plot[Sin[x], {x, 0, 2 Pi}]] -- impressive and pointless at the same time). There are restrictions on what is allowed for a variable (second argument). However, the Derivative of Abs is undefined, but still permitted. There's some wisdom in that, since you can define it to agree with the real function as Mark points out.
|
|
Sep 13, 2014 at 13:56 | comment | added | Dr. Wolfgang Hintze | @Michael E2: I'm a bit confused. I gather from your comments to Mark and me that you consider it permitted to calculate D[Abs[z],z]: you state Abs[] is defined as a function of a complex variable, and there's no hint in the documentation of something else, and also there's no error message appearing when being used. | |
Sep 13, 2014 at 13:45 | comment | added | Dr. Wolfgang Hintze | @Mark: Thanks for your comprehensive replies and suggestions. I hope it is obvious that - as a year long user - I was just surprised to get rather unexpected result when I do things which are completely "legal". i.e. without giving rise to warnings. This can lead to errors more of less hidden (think of having Floor somewhere in a Long expression of which you need to take the derivative, and then have some numerical calculation do to: the spurious oscillations spoil the result). | |
Sep 13, 2014 at 13:31 | comment | added | Michael E2 |
@MarkMcClure My view, perhaps wrong, is that it is not D per se but Abs , Floor , etc. that are defined as functions of a complex variable. That D takes the complex derivative follows naturally. @Dr. Hintze, I recall reading somewhere that Mathematica makes no restriction on what the variables represent unless explicitly stated. So numeric functions are functions of a complex variable, unless the documentation or an error message states that it has to be real or an integer or whatever.
|
|
Sep 12, 2014 at 12:51 | comment | added | Dr. belisarius | @MarkMcClure I haven't marked it as dup. I wanted to leave a link here for those researching problems with derivatives of non-analytic functions in the future | |
Sep 12, 2014 at 12:33 | comment | added | Mark McClure |
@belisarius Your question seems to be exactly opposite of the one here - namely, Plot[Derivative[f]...] uses a finite difference scheme on discrete functions, such as IntegerPart , Round and several others.
|
|
Sep 12, 2014 at 11:59 | comment | added | Dr. belisarius | This issue has been visited before mathematica.stackexchange.com/q/29329/193 | |
Sep 12, 2014 at 11:30 | comment | added | Mark McClure |
Incidentally, Derivative is not protected, so you can easily define your own DownValues: Thus, Abs'[x_] := Sign[x]; Abs'[0.5] produces 1 .
|
|
Sep 12, 2014 at 11:28 | comment | added | Mark McClure |
Well, I guess it's not just D but the general fact that symbolic computation assumes symbols are complex. Many computations performed by Mathematica must be fully understood in this context - from Simplify[Abs[x^2]] to the apparent missing branch of the cube root in Plot[x^(1/3), {x,-1,1}] . There are exceptions, particularly the CubeRoot and Surd functions introduced in V9 but, generally, computations are done in the complex numbers and I assure you that this is the context in which you need to explore your question.
|
|
Sep 12, 2014 at 10:03 | comment | added | Dr. Wolfgang Hintze | @Marc: I know perfectly well what analyticity of functions means. But I was talking about MMA here. Please tell me where your assertion about D can be found in the documentation. | |
Sep 12, 2014 at 9:09 | comment | added | Mark McClure |
A similar thing happens with Re and Im . While those functions are obviously meant to work in the complex realm, I think an understanding of what is going on there is relevant. This discussion might help in that regard.
|
|
Sep 12, 2014 at 9:05 | comment | added | Mark McClure |
It really doesn't matter if you agree or not - the basic fact is that D works in the complex domain and these functions are not differentiable in that context. That, quite simply, is the explanation of the behavior you see. Now, whether you would prefer different behavior and how you might implement it is a different question.
|
|
Sep 12, 2014 at 8:51 | comment | added | Dr. Wolfgang Hintze | @Marc: I don't agree. The derivative of these functions as real functions is well defined except for certain points. I have shown this in the section Remedy? But MMA has difficulties also outside these points. | |
Sep 12, 2014 at 8:44 | comment | added | Mark McClure |
The functions you explore are all non-analytic as complex functions, thus the derivative is undefined. You might explore the numerical derivative ND as defined the NumericalCalculus package.
|
|
Sep 12, 2014 at 8:20 | history | asked | Dr. Wolfgang Hintze | CC BY-SA 3.0 |