Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

Differentiating Complex Conjugated Functions

asked 14 years ago

updated 14 years ago

This is primarily a question of understanding the syntax of some output although there might be a bug hidden underneath. Consider the following code:

sage: var('x,t')
sage: q = function('q',x,t)
sage: f = q*q.conjugate()
sage: print f.derivative(x,1)
q(x, t)*D[0](conjugate)(q(x, t))*D[0](q)(x, t) + conjugate(q(x,t))*D[0](q)(x, t)

The answer is supposed to be d/dx(qˉq)=qxˉq+qˉqx. The second term in the Sage output is correct but I'm having trouble deciphering the first term. Any thoughts?

I think I can narrow down the differences even further. Check it out:

sage: print q.conjugate().derivative(x,1)
D[0](conjugate)(q(x, t))*D[0](q)(x, t)
sage print q.derivative(x,1).conjugate()
conjugate(D[0](q)(x, t))

The independence of order isn't the issue: q=u+iv means that qx=ux+ivx, ˉq=uiv. So ¯qx=uxivx and (ˉq)x=(uiv)x=uxivx.

Preview: (hide)

Comments

Depending on the problem you could just define a new function called qbar as long as you don't expect to conjugate an entire expression. Such is my own case and I got the result I wanted.

cswiercz gravatar imagecswiercz ( 14 years ago )

@kcrisman - what does `D[0](conjugate)` mean?

d3banjan gravatar imaged3banjan ( 12 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 14 years ago

kcrisman gravatar image

updated 14 years ago

It looks like Sage is (incorrectly? naively?) applying the chain rule to conjugate(q(x,t)), since conjugate is a pure symbolic thing in Sage a priori. In fact, the multiple variables are irrelevant:

sage: r = function('r',x)
sage: g = r*r.conjugate()
sage: g.derivative(x)
r(x)*D[0](conjugate)(r(x))*D[0](r)(x) + conjugate(r(x))*D[0](r)(x)

sage: r.conjugate().derivative(x)
D[0](conjugate)(r(x))*D[0](r)(x)
sage: r.derivative().conjugate()
conjugate(D[0](r)(x))

Ginac (and hence Pynac) does not appear to support doing this - see this. However, presumably one could implement a trivial conjugation to the fderivative or tderivative ... the problem is that I'm not sure whether we should automatically assume that this makes sense. See, for instance, the convoluted discussion at The Maple equivalent of ask.sagemath. On the other hand, Sympy allows this. If there is a consensus, a ticket should be opened, though!

Preview: (hide)
link

Comments

Thanks for the resources. Looking at the Sage source, it seems like a lot of tests for the built-in symbolic functions use conjugate so I imagine that major changes to its behavior could result in broken doctests. It might also boil down to changing the way function._conjugate_ behaves. If anyone else suggests on ask.sage that this is a major issue then I'll post a ticket.

cswiercz gravatar imagecswiercz ( 14 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 14 years ago

Seen: 1,948 times

Last updated: Jan 04 '11