Re: Derivative of Root objects

*To*: mathgroup at smc.vnet.net*Subject*: [mg23843] Re: [mg23831] Derivative of Root objects*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Mon, 12 Jun 2000 01:17:34 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Although it is rather dangerous to send an answer to this sort of question before Adam Strzebonski or Daniel Lichtblau send theirs I am tempted to try. Concerning the first part of the question I think you have found a genuine bug in Mathematica. To see it clearly one only has to do a Trace: In[1]:= Clear[f] In[2]:= f[x_] = Root[#^3 - x &, 1]; In[3]:= Trace[f'[x]] Out[3]= {{HoldForm[Derivative[1][f]], {HoldForm[f[#1]], HoldForm[Root[-#1 + #1^3 & , 1]], {HoldForm[(-#1 + #1^3 & )[Integrate`$$a[1]]], HoldForm[-Integrate`$$a[1] + Integrate`$$a[1]^3]}, HoldForm[-1]}, HoldForm[0 & ]}, HoldForm[(0 & )[x]], HoldForm[0]} You can see at once that Mathematica gets confused and instead of the function x -> Root[#^3 - x &, 1] actually considers the function x -> Root[#^3 - # &, 1], which is in fact just x->-1. On the other hand In[5]:= Trace[D[f[x], x]] Out[5]= {{HoldForm[f[x]], HoldForm[Root[-x + #1^3 & , 1]], {HoldForm[(-x + #1^3 & )[Integrate`$$a[1]]], HoldForm[-x + Integrate`$$a[1]^3]}, HoldForm[Root[-x + #1^3 & , 1]]}, HoldForm[D[Root[-x + #1^3 & , 1], x]], HoldForm[1/(3*Root[-x + #1^3 & , 1]^2)]} shows Mathematica solving the problem correctly. However, I am not convinced that there is anything wrong in your second example. I have not investigated it vary carefully but root objects with parameters represent algebraic functions which are of course not smooth (they can have complicated branch cuts). Of course in the case of functions with singularities you can have a zero derivative (where it is defined) without the function itself being constant. I expect that this is the cause of the behaviour you observed in this case. For example, while it is true that In[26]:= D[expr, {y, 3}] // FullSimplify Out[26]= 0 and In[28]:= Series[expr, {y, 1, 3}] \!\(Root::"sbr" \(\(:\)\(\ \)\) "Because of branch cuts, the series may represent a different root of \ \!\(\(\(\(\(\(\(-3\)\)\\ y\\ #1\)\) + \(\(2\\ #1\^3\)\)\)\) &\) for some \ values of \!\(y\)."\) Out[28]= SeriesData[y, 1, {3/2, 3, 3/2}, 0, 4, 1] we get: In[27]:= Series[expr, {y, 0, 3}] \!\(Series::"nmer" : "\!\(Root[\(\(\(\(\(\(\(\(\(\(-3\)\)\\ y\\ #1\)\) + \(\(2\\ #1\^3\)\)\)\) \ &\)\), 3\)\)]\) is not a meromorphic function of \!\(y\) at \!\(0\)."\) Out[27]= Series[y*Root[-3*y*#1 + 2*#1^3 & , 3]^2, {y, 0, 3}] -- Andrzej Kozlowski Toyama International University, JAPAN For Mathematica related links and resources try: <http://www.sstreams.com/Mathematica/> on 6/10/00 4:00 PM, Gianluca Gorni at gorni at dimi.uniud.it wrote: > > Hello! > > It seems that the derivative in the form f'[x] and in the form D[f[x] ,x] > behave differently when f[x] contains Root objects. > > My version is 4.0 for PowerMac. > > Example: > > f[x_] = Root[#^3 - x &, 1]; > > f'[x] gives 0 (wrong, of course) > > D[f[x], x] gives 1/(3*Root[-x + #1^3 & , 1]^2) (right) > > %%%%%%%%%%% > > I take the opportunity to submit a shortcoming of FullSimplify that > I have just found, for developer use: > > expr = y*Root[-3*y*#1 + 2*#1^3 & , 3]^2; > > The third derivative of expr is zero: > > D[expr, {y, 3}]//FullSimplify gives 0. > > Still, FullSimplify does not realize that the second derivative is > constant: > > D[expr, {y,2}]//FullSimplify gives a complicated expression. > > Developer`ZeroQ fails too, because > > Developer`ZeroQ[D[expr, {y,2}]-(D[expr, {y,2}] /. y->1)] > > gives False. > > Best regards, > > Gianluca Gorni