Message Boards Message Boards

0
|
303 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Why Simplify[Arg[z]+Arg[Conjugate[z]], Element[z,Complexes]&& Im[z] !=0] does not evaluate to 0?

Simplify[Arg[z] + Arg[Conjugate[z]], Element[z,Complexes]&&Im[z]!=0] 

does not evaluate although it clearly equals 0 mathematically.

In an attempt to understand this highly undesirable behavior I took into account what the documentation says: 'Arg[z] is left unevaluated if z is not a numeric quantity.' I discarted this as an explanation since the steps to be done to reach the result 0 are not evaluation in the sense of
replacing Arg[z] by some 'result' but transformations of the expression Arg[z] + Arg[Conjugate[z]] making use of the information that z is a complex variable. This is what I understood from the Chapters 3.3.8 - 3.3.10 of 'Mathematica-V5-Book.pdf'. In this honorable old source the intention was to simplify all expressions containing real and complex variables in the way an educated mathematician. would choose. I imagine that by some code revision the general evaluation loop lost some transformation steps that deal with complex sub-expressions containing Arg and Abs - steps that in earlier versions were present. This would say that we deal with a veritable bug in the Wolfram Language which should be easy to repair, but which should become repaired ASAP.

POSTED BY: Ulrich Mutze
3 Replies

ComplexExpand is how I usually deal with complex expressions involving Re[], Im[], Arg[], Abs[], or Conjugate[].:

FullSimplify[
 ComplexExpand[Arg[z] + Arg[Conjugate[z]], z, TargetFunctions -> Conjugate],
 Element[z, Complexes] && Im[z] != 0]
(*  0  *)

One thing to keep in mind is that the simplifiers are in effect discrete minimization algorithms. They minimize something called the "complexity" of the expression as defined by an internal function. That function is dominated by LeafCount[]. The steps of the minimizer come from a set of transformations. If a step results in an expression with much higher complexity, the step is likely to be rejected. Both simplifiers allow a transformed expression to become a little more complex for a few steps; but if it does not become simpler than the current minimum-complexity expression soon, that sequence of transformations will be aborted. All this is to give an idea why FullSimplify does not try the first step with ComplexExpand[] that I used above. It is probably because of the great difference in complexity seen below:

ComplexExpand[Arg[z] + Arg[Conjugate[z]], z, 
  TargetFunctions -> Conjugate] // LeafCount
(*  23  *)

Arg[z] + Arg[Conjugate[z]] // LeafCount
(*  6  *)
POSTED BY: Michael Rogers

Here's another trick I use sometimes to simplify an angle: Take the cosine and sine of the expression. Somehow, although I cannot give an example other than the one at hand, I have the impression that Mathematica deals with sines and cosines more robustly than tangent or its inverse. Maybe not much more robustly, but there seems to be an unequal ability. As you say, it would be better if this were done automatically.

expr = ComplexExpand[
   Arg[x + I  y] - 2  ArcTan[y/(x + Sqrt[x  x + y*y])],
   TargetFunctions -> {Re, Im}];
expr = FullSimplify[Through[{Cos, Sin}[expr]]];
ArcTan @@ expr
(*  0  *)

Or, if you want to enhance FullSimplify:

sincosSimp[t_] := ArcTan @@ FullSimplify[Through[{Cos, Sin}[t]]];
FullSimplify[
 Arg[x + I  y] - 2  ArcTan[y/(x + Sqrt[x  x + y*y])] // 
  ComplexExpand[#, TargetFunctions -> {Re, Im}] &,
 TransformationFunctions -> {Automatic, sincosSimp}]
(*  0  *)

Again, one has to use ComplexExpand, this time to convert Arg[x + I y] to ArcTan[x, y]. FullSimplify[], with x and y assumed to be real, won't do it. (After ComplexExpand, the assumption is no longer necessary.)

POSTED BY: Michael Rogers

Good to see that with a bit of help (use ComplexExpand with TargetFunctions -> Conjugate) Mathematica finds that away from the real axis complex conjugation reverts the sign of Arg. Considering the expression Arg[z] + Arg[Conjugate[z]] was my attempt to find reasons why Mathematica fails to evaluate to 0 the expression Arg[x+Iy] - 2 ArcTan[y/(x+Sqrt[xx+y*y for real x and y and y!=0. Here I found no way to make the ComplexExpand-trick work. It would be great if I could learn a way to deal with this tougher expression. It would be even greater if the know how needed for solving such problems would be built into WL. I'm quite sure that earlier versions of Mathematica (e.g. 6 and 7) behaved smarter in such cases. Also, I hold the strong opinion that if one would have come across these problems at Wolfram Research one would have found ways to solve them without asking for the diligence of the user.

Many thanks, Michael, for your help!

POSTED BY: Ulrich Mutze
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract