Wirtinger Derivatives in Maple 2021

Generally speaking, there are two contexts for differentiating complex functions with respect to complex variables. In the first context, called the classical complex analysis, the derivatives of the complex components ( abs , argument , conjugate , Im , Re , signum ) with respect to complex variables do not exist (do not satisfy the Cauchy-Riemann conditions), with the exception of when they are holomorphic functions. All computer algebra systems implement the complex components in this context, and computationally represent all of abs(z), argument(z), conjugate(z), Im(z), Re(z), signum(z) as functions of z . Then, viewed as functions of z, none of them are analytic, so differentiability becomes an issue.

 

In the second context, first introduced by Poincare (also called Wirtinger calculus), in brief z and its conjugate conjugate(z) are taken as independent variables, and all the six derivatives of the complex components become computable, also with respect to conjugate(z). Technically speaking, Wirtinger calculus permits extending complex differentiation to non-holomorphic functions provided that they are ℝ-differentiable (i.e. differentiable functions of real and imaginary parts, taking f(z) = f(x, y) as a mapping "`ℝ`^(2)->`ℝ`^()").

 

In simpler terms, this subject is relevant because, in mathematical-physics formulations using paper and pencil, we frequently use Wirtinger calculus automatically. We take z and its conjugate conjugate(z) as independent variables, with that d*conjugate(z)*(1/(d*z)) = 0, d*z*(1/(d*conjugate(z))) = 0, and we compute with the operators "(∂)/(∂ z)", "(∂)/(∂ (z))" as partial differential operators that behave as ordinary derivatives. With that, all of abs(z), argument(z), conjugate(z), Im(z), Re(z), signum(z), become differentiable, since they are all expressible as functions of z and conjugate(z).

 

 

Wirtinger derivatives were implemented in Maple 18 , years ago, in the context of the Physics package. There is a setting, Physics:-Setup(wirtingerderivatives), that when set to true - an that is the default value when Physics is loaded - redefines the differentiation rules turning on Wirtinger calculus. The implementation, however, was incomplete, and the subject escaped through the cracks till recently mentioned in this Mapleprimes post.

 

Long intro. This post is to present the completion of Wirtinger calculus in Maple, distributed for everybody using Maple 2021 within the Maplesoft Physics Updates v.929 or newer. Load Physics and set the imaginary unit to be represented by I

 

with(Physics); interface(imaginaryunit = I)

 

The complex components are represented by the computer algebra functions

(FunctionAdvisor(complex_components))(z)

[Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)]

(1)

They can all be expressed in terms of z and conjugate(z)

map(proc (u) options operator, arrow; u = convert(u, conjugate) end proc, [Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)])

[Im(z) = ((1/2)*I)*(-z+conjugate(z)), Re(z) = (1/2)*z+(1/2)*conjugate(z), abs(z) = (z*conjugate(z))^(1/2), argument(z) = -I*ln(z/(z*conjugate(z))^(1/2)), conjugate(z) = conjugate(z), signum(z) = z/(z*conjugate(z))^(1/2)]

(2)

The main differentiation rules in the context of Wirtinger derivatives, that is, taking z and conjugate(z) as independent variables, are

map(%diff = diff, [Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)], z)

[%diff(Im(z), z) = -(1/2)*I, %diff(Re(z), z) = 1/2, %diff(abs(z), z) = (1/2)*conjugate(z)/abs(z), %diff(argument(z), z) = -((1/2)*I)/z, %diff(conjugate(z), z) = 0, %diff(signum(z), z) = (1/2)/abs(z)]

(3)

Since in this context conjugate(z) is taken as - say - a mathematically-atomic variable (the computational representation is still the function conjugate(z)) we can differentiate all the complex components also with respect to  conjugate(z)

map(%diff = diff, [Im(z), Re(z), abs(z), argument(z), conjugate(z), signum(z)], conjugate(z))

[%diff(Im(z), conjugate(z)) = (1/2)*I, %diff(Re(z), conjugate(z)) = 1/2, %diff(abs(z), conjugate(z)) = (1/2)*z/abs(z), %diff(argument(z), conjugate(z)) = ((1/2)*I)*z/abs(z)^2, %diff(conjugate(z), conjugate(z)) = 1, %diff(signum(z), conjugate(z)) = -(1/2)*z^2/abs(z)^3]

(4)

For example, consider the following algebraic expression, starting with conjugate

eq__1 := conjugate(z)+z*conjugate(z)^2

conjugate(z)+z*conjugate(z)^2

(5)

Differentiating this expression with respect to z and conjugate(z) taking them as independent variables, is new, and in this example trivial

(%diff = diff)(eq__1, z)

%diff(conjugate(z)+z*conjugate(z)^2, z) = conjugate(z)^2

(6)

(%diff = diff)(eq__1, conjugate(z))

%diff(conjugate(z)+z*conjugate(z)^2, conjugate(z)) = 1+2*z*conjugate(z)

(7)

Switch to something less trivial, replace conjugate by the real part ReNULL

eq__2 := eval(eq__1, conjugate = Re)

Re(z)+z*Re(z)^2

(8)

To verify results further below, also express eq__2 in terms of conjugate

eq__22 := simplify(convert(eq__2, conjugate), size)

(1/4)*(z^2+z*conjugate(z)+2)*(z+conjugate(z))

(9)

New: differentiate eq__2 with respect to z and  conjugate(z)

(%diff = diff)(eq__2, z)

%diff(Re(z)+z*Re(z)^2, z) = 1/2+Re(z)^2+z*Re(z)

(10)

(%diff = diff)(eq__2, conjugate(z))

%diff(Re(z)+z*Re(z)^2, conjugate(z)) = 1/2+z*Re(z)

(11)

Note these results (10) and (11) are expressed in terms of Re(z), not conjugate(z). Let's compare with the derivative of eq__22 where everything is expressed in terms of z and conjugate(z). Take for instance the derivative with respect to z

(%diff = diff)(eq__22, z)

%diff((1/4)*(z^2+z*conjugate(z)+2)*(z+conjugate(z)), z) = (1/4)*(2*z+conjugate(z))*(z+conjugate(z))+(1/4)*z^2+(1/4)*z*conjugate(z)+1/2

(12)

To verify this result is mathematically equal to (10) expressed in terms of Re(z) take the difference of the right-hand sides

rhs((%diff(Re(z)+z*Re(z)^2, z) = 1/2+Re(z)^2+z*Re(z))-(%diff((1/4)*(z^2+z*conjugate(z)+2)*(z+conjugate(z)), z) = (1/4)*(2*z+conjugate(z))*(z+conjugate(z))+(1/4)*z^2+(1/4)*z*conjugate(z)+1/2)) = 0

Re(z)^2+z*Re(z)-(1/4)*(2*z+conjugate(z))*(z+conjugate(z))-(1/4)*z^2-(1/4)*z*conjugate(z) = 0

(13)

One quick way to verify the value of expressions like this one is to replace z = a+I*b and simplify "assuming" a andNULLb are realNULL

`assuming`([eval(Re(z)^2+z*Re(z)-(1/4)*(2*z+conjugate(z))*(z+conjugate(z))-(1/4)*z^2-(1/4)*z*conjugate(z) = 0, z = a+I*b)], [a::real, b::real])

a^2+(a+I*b)*a-(1/2)*(3*a+I*b)*a-(1/4)*(a+I*b)^2-(1/4)*(a+I*b)*(a-I*b) = 0

(14)

normal(a^2+(a+I*b)*a-(1/2)*(3*a+I*b)*a-(1/4)*(a+I*b)^2-(1/4)*(a+I*b)*(a-I*b) = 0)

0 = 0

(15)

The equivalent differentiation, this time replacing in eq__1 conjugate by abs; construct also the equivalent expression in terms of z and  conjugate(z) for verifying results

eq__3 := eval(eq__1, conjugate = abs)

abs(z)+abs(z)^2*z

(16)

eq__33 := simplify(convert(eq__3, conjugate), size)

(z*conjugate(z))^(1/2)+conjugate(z)*z^2

(17)

Since these two expressions are mathematically equal, their derivatives should be too, and the derivatives of eq__33 can be verified by eye since z and  conjugate(z) are taken as independent variables

(%diff = diff)(eq__3, z)

%diff(abs(z)+abs(z)^2*z, z) = (1/2)*conjugate(z)/abs(z)+z*conjugate(z)+abs(z)^2

(18)

(%diff = diff)(eq__33, z)

%diff((z*conjugate(z))^(1/2)+conjugate(z)*z^2, z) = (1/2)*conjugate(z)/(z*conjugate(z))^(1/2)+2*z*conjugate(z)

(19)

Eq (18) is expressed in terms of abs(z) = abs(z) while (19) is in terms of conjugate(z) = conjugate(z). Comparing as done in (14)

rhs((%diff(abs(z)+abs(z)^2*z, z) = (1/2)*conjugate(z)/abs(z)+z*conjugate(z)+abs(z)^2)-(%diff((z*conjugate(z))^(1/2)+conjugate(z)*z^2, z) = (1/2)*conjugate(z)/(z*conjugate(z))^(1/2)+2*z*conjugate(z))) = 0

(1/2)*conjugate(z)/abs(z)-z*conjugate(z)+abs(z)^2-(1/2)*conjugate(z)/(z*conjugate(z))^(1/2) = 0

(20)

`assuming`([eval((1/2)*conjugate(z)/abs(z)-z*conjugate(z)+abs(z)^2-(1/2)*conjugate(z)/(z*conjugate(z))^(1/2) = 0, z = a+I*b)], [a::real, b::real])

(1/2)*(a-I*b)/(a^2+b^2)^(1/2)-(a+I*b)*(a-I*b)+a^2+b^2-(1/2)*(a-I*b)/((a+I*b)*(a-I*b))^(1/2) = 0

(21)

simplify((1/2)*(a-I*b)/(a^2+b^2)^(1/2)-(a+I*b)*(a-I*b)+a^2+b^2-(1/2)*(a-I*b)/((a+I*b)*(a-I*b))^(1/2) = 0)

0 = 0

(22)

To mention but one not so famliar case, consider the derivative of the sign of a complex number, represented in Maple by signum(z). So our testing expression is

eq__4 := eval(eq__1, conjugate = signum)

signum(z)+z*signum(z)^2

(23)

This expression can also be rewritten in terms of z and  conjugate(z) 

eq__44 := simplify(convert(eq__4, conjugate), size)

z/(z*conjugate(z))^(1/2)+z^2/conjugate(z)

(24)

This time differentiate with respect to conjugate(z),

(%diff = diff)(eq__4, conjugate(z))

%diff(signum(z)+z*signum(z)^2, conjugate(z)) = -(1/2)*z^2/abs(z)^3-z^3*signum(z)/abs(z)^3

(25)

Here again, the differentiation of eq__44, that is expressed entirely in terms of z and  conjugate(z), can be computed by eye

(%diff = diff)(eq__44, conjugate(z))

%diff(z/(z*conjugate(z))^(1/2)+z^2/conjugate(z), conjugate(z)) = -(1/2)*z^2/(z*conjugate(z))^(3/2)-z^2/conjugate(z)^2

(26)

Eq (25) is expressed in terms of abs(z) = abs(z) while (26) is in terms of conjugate(z) = conjugate(z). Comparing as done in (14),

rhs((%diff(signum(z)+z*signum(z)^2, conjugate(z)) = -(1/2)*z^2/abs(z)^3-z^3*signum(z)/abs(z)^3)-(%diff(z/(z*conjugate(z))^(1/2)+z^2/conjugate(z), conjugate(z)) = -(1/2)*z^2/(z*conjugate(z))^(3/2)-z^2/conjugate(z)^2)) = 0

-(1/2)*z^2/abs(z)^3-z^3*signum(z)/abs(z)^3+(1/2)*z^2/(z*conjugate(z))^(3/2)+z^2/conjugate(z)^2 = 0

(27)

`assuming`([eval(-(1/2)*z^2/abs(z)^3-z^3*signum(z)/abs(z)^3+(1/2)*z^2/(z*conjugate(z))^(3/2)+z^2/conjugate(z)^2 = 0, z = a+I*b)], [a::real, b::real])

-(1/2)*(a+I*b)^2/(a^2+b^2)^(3/2)-(a+I*b)^4/(a^2+b^2)^2+(1/2)*(a+I*b)^2/((a+I*b)*(a-I*b))^(3/2)+(a+I*b)^2/(a-I*b)^2 = 0

(28)

simplify(-(1/2)*(a+I*b)^2/(a^2+b^2)^(3/2)-(a+I*b)^4/(a^2+b^2)^2+(1/2)*(a+I*b)^2/((a+I*b)*(a-I*b))^(3/2)+(a+I*b)^2/(a-I*b)^2 = 0)

0 = 0

(29)

NULL


 

Download Wirtinger_Derivatives.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft


Please Wait...