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 - Filling between two spheres in SphericalPlot3D

Manipulate[ SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, Mesh -> None, PlotPoints -> 15, PlotRange -> {-2.2, 2.2}], {n, 0, 1}] I cant' seem to be able to make a filling between two spheres. I've already tried the obvious Filling -> {1 -> {2}} but Mathematica doesn't seem to like that option. Is there any easy way around this or ... Answer There is no built-in filling in SphericalPlot3D . One option is to use ParametricPlot3D to draw the surfaces between the two shells: Manipulate[ Show[SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, PlotPoints -> 15, PlotRange -> {-2.2, 2.2}], ParametricPlot3D[{ r {Sin[t] Cos[1.5 Pi], Sin[t] Sin[1.5 Pi], Cos[t]}, r {Sin[t] Cos[0 Pi], Sin[t] Sin[0 Pi], Cos[t]}}, {r, 1, 2 - n}, {t, 0, Pi}, PlotStyle -> Yellow, Mesh -> {2, 15}]], {n, 0, 1}]

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]

plotting - Mathematica: 3D plot based on combined 2D graphs

I have several sigmoidal fits to 3 different datasets, with mean fit predictions plus the 95% confidence limits (not symmetrical around the mean) and the actual data. I would now like to show these different 2D plots projected in 3D as in but then using proper perspective. In the link here they give some solutions to combine the plots using isometric perspective, but I would like to use proper 3 point perspective. Any thoughts? Also any way to show the mean points per time point for each series plus or minus the standard error on the mean would be cool too, either using points+vertical bars, or using spheres plus tubes. Below are some test data and the fit function I am using. Note that I am working on a logit(proportion) scale and that the final vertical scale is Log10(percentage). (* some test data *) data = Table[Null, {i, 4}]; data[[1]] = {{1, -5.8}, {2, -5.4}, {3, -0.8}, {4, -0.2}, {5, 4.6}, {1, -6.4}, {2, -5.6}, {3, -0.7}, {4, 0.04}, {5, 1.0}, {1, -6.8}, {2, -4.7}, {3, -1.