Ask Your Question

Revision history [back]

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)))

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[0](imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(y))
sage: dbar(mysin) == (0,0)
False

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

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

If we try with a non-holomorphic one:

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

Not bad.

But HEY, x and y are assumed to be complex, 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.

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[0](imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(y))
sage: dbar(mysin) == (0,0)
False

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

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

If we try with a non-holomorphic one:

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

Not bad.

But HEY, x and y are assumed to be complex, 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.

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[0](imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(y))
sage: dbar(mysin) == (0,0)
False

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

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

If we try with a non-holomorphic one:

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

Not bad.

But HEY, x and y are assumed to be complex, 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.

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[0](imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(y))
sage: dbar(mysin) == (0,0)
False

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

sage: dbar(mysin)[0].full_simplify()
(x, y) |--> 0
sage: dbar(mysin)[1].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)[0].full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2
sage: dbar(f)[1].full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2

Not bad.

But HEY, x and y are assumed to be complex, 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.

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[0](imag_part)(x) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](imag_part)(y) + 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](real_part)(y), 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(x) - 1/2*cos(-imag_part(y) + real_part(x))*cosh(imag_part(x) + real_part(y))*D[0](imag_part)(y) - 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(x) + 1/2*sin(-imag_part(y) + real_part(x))*sinh(imag_part(x) + real_part(y))*D[0](real_part)(y))
sage: dbar(mysin) == (0,0)
False

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

sage: dbar(mysin)[0].full_simplify()
(x, y) |--> 0
sage: dbar(mysin)[1].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)[0].full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2
sage: dbar(f)[1].full_simplify()
(x, y) |--> -1/2*cos(y)*sin(x) + 1/2*cos(x)*sin(y) + 1/2

Not bad.

But HEY, x and y are not assumed to be complex, 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.