# Why is diff(conjugate(x),x) unevaluated?

Or, can we differentiate holomorphic functions only?

Wirtinger defined two derivations in complex analysis for which we have: diff(x,conjugate(x)) = 0 and diff(conjugate(x),x) = 0.

http://en.wikipedia.org/wiki/Wirtinge...

Wirtinger calculus has important applications in optimization and has been extended to quaternion functions.

Is there any situation in which leaving diff(conjugate(x),x) unevaluated is an advantage?

edit retag close merge delete

Sort by » oldest newest most voted

I am not sure this will answer your question, but perhaps could you use two variables, though is is a bit tedious:

sage: var('x y')
(x, y)
sage: conj(x,y) = (x,-y)
sage: diff(conj)
[ (x, y) |--> 1  (x, y) |--> 0]
[ (x, y) |--> 0 (x, y) |--> -1]


Then you can define i, d and dbar as follows:

sage: i(x,y) = (-y,x)
sage: d = lambda f : 1/2*diff(f,x)-1/2*i(*diff(f,y))
sage: dbar = lambda f : (1/2*diff(f,x)+ 1/2*i(*diff(f,y)))

sage: d(conj)
(x, y) |--> (0, 0)
sage: dbar(conj)
(x, y) |--> (1, 0)


Let us check that sin is holomorphic:

sage: mysin(x,y) = (real(sin(x+I*y)),imag(sin(x+I*y)))
sage: dbar(mysin)
(x, y) |--> (1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D(imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D(imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D(real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D(real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D(imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D(imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D(real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D(real_part)(y))
sage: dbar(mysin) == (0,0)
False


Hmm, not enough, we have to simplify the expressions first:

sage: dbar(mysin).full_simplify()
(x, y) |--> 0
sage: dbar(mysin).full_simplify()
(x, y) |--> 0


If we try with a non-holomorphic one:

sage: f(x,y) = (x+y, cos(x-y))
sage: dbar(f).full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2
sage: dbar(f).full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2


But HEY, x and y are not assumed to be real, so i should not get 0 here. There is an assumption mechanism that tells Sage that x and y are real, but we did not use it here. Well, how to say:

sage: real_part(x).full_simplify()
x
sage: imag_part(x).full_simplify()
0


This is indeed a bug of the ugly Symbolic Ring, which we turned into a feature ! I let you define d and dbar to include full_simplify in them.

more

Thanks. This is cute, but as you say does not really answer the question. I am thinking of a way to make diff equivalent to your d operator, then dbar can be implemented simply by substituting a dummy variable for conjugate(x).