Skip to main content

calculus and analysis - What is the best way to define Wirtinger derivatives


Wirtinger derivatives ( also called Cauchy operators) in complex analysis are widely used tools. They are defined in the case of one dimensional complex plane as follows


$$\frac{\partial}{\partial z}=\frac12\left(\frac{\partial}{\partial x}-i\frac{\partial}{\partial y}\right),\quad \frac{\partial}{\partial \bar{z}}=\frac12\left(\frac{\partial}{\partial x}+i\frac{\partial}{\partial y}\right)$$



Where $z=x+i y$ and x,y are real variables. Apparently Mathematica does not support directly these operators. For instance, as it is pointed in my question; Defining a complex partial differential operator, D[ , ] don't support a complex argument #2.


What is the best way to generalize D such that it supports complex variable z = x + I y, such that it is homogeneous with derivatives of the real part x and imaginary part y in a fashion where results of formal computations can be given in terms of x and y, or in terms of z and Conjugate[z]




Update :


Following the suggestion of @xzczd, let me articulate about the concept I have in my head. But the details here are not all requirements for an answer on my question above. It is indeed the converse. As a beginner on Mathematica, any insight can be very helpful for me


Let denote by Dc The wanted generalization of D. The first argument of Dc will be a complex function, expressed in term of a variable z := x + I y. The second argument will be x OR y OR z OR Conjugate[z] (in general real or complex). The third argument will contain a rule of the form Coordinates->"Complex" or "real" which depends of the wanted output whether in terms of $\partial_z$ and $\partial_{\bar{z}}$ or in terms of $\partial_x$ and $\partial_{y}$. note that $\partial_z$ and $\partial_{\bar{z}}$ are defined by the formulas given above. Let's suppose that "Complex" is the default value.


Examples: (I denote by === the output, I use some TeX code, hope it is clear)


Basic identities


Dc[z,z] === 1
Dc[Conjugate[z],z] === 0

Dc[Abs[z],Conjugate[z]] === z
Dc[x,z] === 1/2

General identities


Dc[f[z],z] === \partial_z[f[z]]
Dc[f[z],z,Coordinates->"Real"] === 1/2 \partial_x[f[z]] - 1/2 I \partial_y[f[z]]
x Dc[f[z],x] + y Dc[f[z],y] === z\partial_z[f[z]] + \bar{z} \partial_{\bar{z}} [f[z]]

I hope it is more clear now, and the concept makes some sense. Let me know if you need further explanations.



Answer




Here is one idea for supporting derivatives with respect to $z$ and $z^*$. First, we need to use SetSystemOptions to avoid differentiating Conjugate/Abs. Something like:


old = "ExcludedFunctions" /. 
("DifferentiationOptions" /. SystemOptions["DifferentiationOptions"]);
SetSystemOptions["DifferentiationOptions" ->
"ExcludedFunctions" -> Union@Join[old,{Abs, Conjugate}]
];

Then, we need to teach D how to differentiate Conjugate/Abs the way we want. To do this we need to make use of the NonConstants option of D so that derivatives of functions with a hidden dependence on Conjugate[z] with respect to Conjugate[z] do not automatically evaluate to 0.


Unprotect[Conjugate, Abs];
Conjugate /: D[z, Conjugate[z], NonConstants->{z}] := 0;

Conjugate /: D[Conjugate[f_], w_, NonConstants->{z}] := Conjugate[D[f, Conjugate[w], NonConstants->{z}]];
Abs /: D[Abs[f_], w_, NonConstants->{z}] := 1/(2Abs[f]) D[Conjugate[f]f, w, NonConstants->{z}]

Without the NonConstants->{z} option, something like D[Abs[z]^2, Conjugate[z]] will evaluate to 0.


D[Abs[z]^2, Conjugate[z]]
D[Abs[z]^2, Conjugate[z], NonConstants->{z}]


0


z




Here are some examples:


D[z, z, NonConstants->{z}]
D[Conjugate[z], z, NonConstants->{z}]
D[Abs[z]^2, Conjugate[z],NonConstants->{z}]
D[(z+Conjugate[z])/2, z, NonConstants->{z}]


1


0



z


1/2



It might be convenient to create a function to package up everything up:


ComplexD[expr_, z__] := With[
{
v = Union @ Cases[{z}, s_Symbol | Conjugate[s_Symbol] | {s_Symbol | Conjugate[s_Symbol], _} :> s],
old = "ExcludedFunctions" /. ("DifferentiationOptions" /. SystemOptions["DifferentiationOptions"])
},
Internal`WithLocalSettings[

SetSystemOptions["DifferentiationOptions" -> "ExcludedFunctions" -> Join[old, {Abs, Conjugate}]];
Unprotect[Conjugate, Abs];
Conjugate /: D[w_, Conjugate[w_], NonConstants->v] := 0;
Conjugate /: D[Conjugate[f_], w_, NonConstants->v] := Conjugate[D[f, Conjugate[w], NonConstants->v]];
Abs /: D[Abs[f_], w_, NonConstants->v] := 1/(2Abs[f]) D[Conjugate[f]f, w, NonConstants->v],

D[expr, z, NonConstants->v],

SetSystemOptions["DifferentiationOptions" -> "ExcludedFunctions" -> old];
Conjugate /: D[w_, Conjugate[w_], NonConstants->v] =.;

Conjugate /: D[Conjugate[f_], w_, NonConstants->v] =.;
Abs /: D[Abs[f_], w_, NonConstants->v] =.;
Protect[Conjugate, Abs];
]
]

The function ComplexD will temporarily change the system options and give Conjugate/Abs the desired D behavior. An example:


ComplexD[Conjugate@Sin[z Conjugate[z]^2], z]
ComplexD[Exp[Conjugate[w] z], Conjugate[w]]



2 z Conjugate[z] Cos[z^2 Conjugate[z]]


E^(z Conjugate[w]) z



Comments

Popular posts from this blog

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...

equation solving - Invert and fit implicitly defined curve

I need to fit an implicitly defined curve. I thought I could get some data out of Solve , and then using FindFit . Therefore, I would like to find the relation the parametric curve defined by $F(x,y)=0$: Solve[-(1/2) + 1/2 (0.41202 BesselK[0, 0.1 Sqrt[x^2 + y^2]] + (0.101483 x BesselK[1, 0.1 Sqrt[x^2 + y^2]])/Sqrt[x^2 + y^2]) == 0, y] But I can't get an output: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help. >> Edit: In particular, I would like to fit the data coming from the curve with the expression of another curve, and not with a function $f(x)$. In particular, since this clearly looks like a cardioid , I would like it to fit to something like it. What other strategies could I try?

dynamic - How can I make a clickable ArrayPlot that returns input?

I would like to create a dynamic ArrayPlot so that the rectangles, when clicked, provide the input. Can I use ArrayPlot for this? Or is there something else I should have to use? Answer ArrayPlot is much more than just a simple array like Grid : it represents a ranged 2D dataset, and its visualization can be finetuned by options like DataReversed and DataRange . These features make it quite complicated to reproduce the same layout and order with Grid . Here I offer AnnotatedArrayPlot which comes in handy when your dataset is more than just a flat 2D array. The dynamic interface allows highlighting individual cells and possibly interacting with them. AnnotatedArrayPlot works the same way as ArrayPlot and accepts the same options plus Enabled , HighlightCoordinates , HighlightStyle and HighlightElementFunction . data = {{Missing["HasSomeMoreData"], GrayLevel[ 1], {RGBColor[0, 1, 1], RGBColor[0, 0, 1], GrayLevel[1]}, RGBColor[0, 1, 0]}, {GrayLevel[0], GrayLevel...