Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute a partial derivative with respect to a complex variable or its conjugate
ResourceFunction["ComplexD"][f,z] gives the partial derivative | |
ResourceFunction["ComplexD"][f,Conjugate[z]] gives the partial derivative with respect to the complex conjugate of z. | |
ResourceFunction["ComplexD"][f,{z,n}] gives the multiple derivative. |
Complex derivative of a function:
In[1]:= | ![]() |
Out[1]= | ![]() |
ComplexD works with Abs:
In[2]:= | ![]() |
Out[2]= | ![]() |
Compare ComplexD with its definition for a function:
In[3]:= | ![]() |
Find the complex derivative using the definition in terms of derivatives with respect to the real and imaginary parts:
In[4]:= | ![]() |
Out[4]= | ![]() |
Use ComplexExpand on the output of ComplexD:
In[5]:= | ![]() |
Out[5]= | ![]() |
More complicated expressions can be differentiated by first complex expanding the expression into one that consists of Conjugate only:
In[6]:= | ![]() |
Out[6]= | ![]() |
Use ComplexD to find the real derivative (i.e. the derivative with respect to the real part only):
In[7]:= | ![]() |
For example, here is the "real" derivative of Abs:
In[8]:= | ![]() |
Out[8]= | ![]() |
Compare to the usual definition of the real derivative (h is treated as real here):
In[9]:= | ![]() |
Out[9]= | ![]() |
The complex variable z and its conjugate are independent:
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License