1

Consider

c = Cos[phi];
s = Sin[phi];
ArcTan[c, s] // PowerExpand
ArcTan[s/c] // PowerExpand

which yields

ArcTan[Cos[phi], Sin[phi]]
phi

Oddly, PowerExpand does not find its way with the two argument version of ArcTan. However, it does with the single argument ArcTan, as expected.

I like to use ArcTan with two arguments since it does not suffer from division by zero unless numerator and denominator are zero.

How can I tell PowerExpand to find its way into all inverse triginometric functions (assuming positive real variables, etc)?

What side effect would I suffer, if I attach a rule to PowerExpand or better yet to inverse trigonometric functions to deal with ArcTan[c, s] as ArcTan[s/c]? What other identities around trigonometric and inverse trigonometric functions and the exponential function that would also fit such considerations?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Adalbert Hanßen
  • 2,808
  • 12
  • 26
  • You might consider using the identity $$\arctan(x,y)=2\arctan\left(\frac{y}{x+\sqrt{x^2+y^2}}\right)$$ as a replacement rule... – J. M.'s missing motivation Mar 03 '16 at 11:22
  • I think the two argument form is intended to be used as computational convenience and not as a mathematical function. – m_goldberg Mar 03 '16 at 11:31
  • 1
    @m_goldberg the 2-argument form of ArcTan is the only way to recover the angle in the correct quadrant, so it is a distinct function from the 1-argument form. – Jason B. Mar 03 '16 at 11:33
  • @adalbert-hanßen, I don't foresee any negative consequences of doing Unprotect[PowerExpand]; PowerExpand[ArcTan[a_, b_]] := PowerExpand[ArcTan[b/a]]; Protect[PowerExpand]; It gives the return that you are looking for – Jason B. Mar 03 '16 at 11:35
  • @JasonB. I am well aware of that. But I don't see how your comment either illuminates or invalidates my comment. My point, to clarify it, is that I don't think the two argument form is meant for symbolic work where PowerExpand is relevant. – m_goldberg Mar 03 '16 at 11:51
  • @m_goldberg Okay, I guess I still dont know what you mean by it being used not as a mathematical function. – Jason B. Mar 03 '16 at 11:52
  • @JasonB. I recommend using up-values. Unprotect[ArcTan]; PowerExpand[ArcTan[a_, b_]] ^:= PowerExpand[ArcTan[b/a]]; Protect[ArcTan]; – m_goldberg Mar 03 '16 at 11:59
  • @m_goldberg - can you elaborate on why, in this particular case, it's better to apply the rule as an upvalue to ArcTan rather than as a downvalue to PowerExpand? I get that upvalues are more localized in general than downvalues, but in this case I don't see what the difference would be. – Jason B. Mar 03 '16 at 12:13
  • For your consideration: ArcTan[x, y] // TrigToExp ;) – J. M.'s missing motivation Mar 03 '16 at 12:15
  • @J.M. - now try ArcTan[c, s] // TrigToExp // FullSimplify and then tell me why that doesn't simplify further... Scratch that, I see my mistake – Jason B. Mar 03 '16 at 12:26
  • @Jason, the fact that Exp[] is $2\pi i$-periodic has something to do with it. ;) – J. M.'s missing motivation Mar 03 '16 at 12:32
  • @JasonB. In your version, the new rule will be considered every time PowerExpand is called, even when the expression being evaluated has nothing to do with ArcTan. With ^:= is will only considered when Arctan has been seen as an argument. – m_goldberg Mar 03 '16 at 12:33

0 Answers0