Let
declare(z,complex);
depends(z,q);
So,
diff(z,q,1) is complex variable and then
abs(diff(z,q,1))^2 equal to diff(z,q,1)*conjugate(diff(z,q,1))
Maxima gives incorect result. It writes
('diff(z,q,1))^2
But it should be
abs(diff(z,q,1))^2
or
diff(z,q,1)*conjugate(diff(z,q,1))
or
realpart(diff(z,q,1))^2+imagpart(diff(z,q,1))^2
I believe the origin of this problem is that Maxima doesn't understand that the derivative of a complex variable is complex. I haven't thought about this very much yet, but I believe it should be relatively straightforward to fix it.