Message Boards Message Boards

GROUPS:

Issue in D[ ] in 12.3.0 but not in 12.1.0

Posted 4 months ago
1199 Views
|
3 Replies
|
3 Total Likes
|

Here is the terminal log from 12.1.0, where everything is correct:

$ math12
Mathematica 12.1.0 Kernel for Linux x86 (64-bit)
Copyright 1988-2020 Wolfram Research, Inc.

In[1]:= $Assumptions = Element[x,Reals]                                                                                              

Out[1]= x \[Element] Reals

In[2]:= a=Exp[x]                                                                                                                     

         x
Out[2]= E

In[3]:= D[a*Conjugate[a],x] // ComplexExpand // Simplify                                                                             

           2 x
Out[3]= 2 E

and here is the log from 12.3.0 which shows the problem:

$ math
Mathematica 12.3.0 Kernel for Linux x86 (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.

In[1]:= $Assumptions = Element[x,Reals]                                                                                              

Out[1]= x \[Element] Reals

In[2]:= a=Exp[x]                                                                                                                     

         x
Out[2]= E

In[3]:= D[a*Conjugate[a],x] // ComplexExpand // Simplify                                                                             

         2 x
Out[3]= E    (1 + I Im[Conjugate'[x]] + Re[Conjugate'[x]])

In[4]:= D[a*Conjugate[a],x] // ComplexExpand[#, TargetFunctions->Conjugate] & // Simplify                                            

         2 x
Out[4]= E    (1 + Conjugate'[x])

Of course, if I did "ComplexExpand" and "Simplify" prior to differentiation, then it would work in 12.3.0 also, but this is clearly a bug, i.e. differentiation should be aware of the assumption that 'x' is real-valued. And in 12.1.0 it was aware, as the log above shows.

3 Replies

The D function itself doesn't make use of the Assumptions system, but Simplify does. A few notes:

a) It's common to try FullSimplify:

D[a*Conjugate[a], x] // ComplexExpand // FullSimplify

Although this only gives:

E^(2*x)*(1 + Derivative[1][Conjugate][x])

b) Derivatives and Conjugate don't mix well. D by default assumes you mean complex differentiation and there Conjugate can't be differentiated. This shocks a fair number of engineers and physicists who are used to working with it anyway. If you search online, there are a large number of clever and probably too complicated workarounds for this.

c) so the real crux of what's happening here is:

ComplexExpand[I Im[Derivative[1][Conjugate][x]] + Re[Derivative[1][Conjugate][x]]]

I Im[Derivative[1][Conjugate][x]] + Re[Derivative[1][Conjugate][x]]

Why doesn't it give 1? My best guess is that it is being conservative and not trying to interpret what the derivative means, which is probably an intentional change.

I am just guessing. Derivatives and integrals in Mathematica were built from the start in the complex variable. Given that, such functions as Conjugate and Abs are not differentiable, and their derivative is left unevaluated. Since version 11.1 we have RealAbs, which does have a derivative, but is not very well blended with the rest of the system yet. Maybe we need RealIntegrate and RealD too. I wonder what RealConjugate may mean.

Thank you very much for the replies.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract