0

I'm trying to simplify an expression with sums of ArcTan, for which I've written a transformation rule that works for simple sums, so that ArcTan[a] + ArcTan[b] -> ArcTan[(a+b)/(1-ab)]. However, it fails for terms of the type 5 ArcTan[a] + ArcTan[b]. One way to simplify this expression would be to expand the integer into a sum of units, then transform repeatedly until the expression consists of only one ArcTan, but I haven't been able so far to find the way.

I've tried Hold,Distribute, Sum,Fold with Plusto no avail.

auxsvr
  • 517
  • 2
  • 11

2 Answers2

2

How about this?

ArcTan[Simplify[TrigExpand[Tan[5 ArcTan[a] + ArcTan[b]]]]]

ArcTan Simplify

Could save yourself some work!

Explanation:

The trick here is to understand the identity you mentioned is about Tan, not ArcTan:

Tan[x+y] = (Tan[x]+Tan[y])/(1 -Tan[x]Tan[y]).

TrigExpand does the above type of expansion for trig functions. Replace x and y with ArcTan[a] and ArcTan[b], then take ArcTan of both sides and you have your identity. Simplify collects the terms of the expansion into one.

The same method works for any linear combination of x=Arctan[a] and y=Arctan[b].

Michael
  • 143
  • 7
  • Thanks. Simple and effective. Is there some reference for simplifications in Mathematica? – auxsvr Jul 15 '14 at 16:57
  • I just checked the help file for ArcTan. Look at ref/ArcTan->Applications->Addition theorem for tangent function. They use exactly the same technique, which is reassuring. There are various tutorials in the document centre. Look under "Algebraic Manipulation". However I simply search for a function e.g. TrigExpand and then use "See Also" at the bottom to find other related functions e.g. TrigReduce. – Michael Jul 16 '14 at 10:53
1

How about:

5 ArcTan[a] + ArcTan[b] /.
 {(m_Integer: 1) ArcTan[a_] + (n_Integer: 1) ArcTan[b_] /; Positive[m] && Positive[n] :>
   With[{min = Min[m, n]},
    (m - min) ArcTan[a] + (n - min) ArcTan[b] + 
     min ArcTan[(a + b)/(1 - ab)]]}

(* 4 ArcTan[a] + ArcTan[(a + b)/(1 - ab)] *)

Works on positive integral coefficients, which is how I read the question:

7 ArcTan[a] + 4 ArcTan[b] /.
 {(m_Integer: 1) ArcTan[a_] + (n_Integer: 1) ArcTan[b_] /; Positive[m] && Positive[n] :>
   With[{min = Min[m, n]},
    (m - min) ArcTan[a] + (n - min) ArcTan[b] + 
     min ArcTan[(a + b)/(1 - ab)]]}

(* 3 ArcTan[a] + 4 ArcTan[(a + b)/(1 - ab)] *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • Thanks. I had to change a to a_ and b to b_ for this to work with arbitrary arguments. Is there a way to do the expansion in the title? – auxsvr Jul 15 '14 at 10:57
  • Also, generalization to negative integers requires to write 2 more transformation rules or is there a simpler way? Mathematica automatically simplifies ArcTan[-x] to -ArcTan[x] and makes it harder, is there a way to stop automatic simplifications? – auxsvr Jul 15 '14 at 11:22
  • In order to incorporate negative integers, this seems to work: ArcTanSimplify = {(m_Integer: 1) ArcTan[a_] + (n_Integer: 1) ArcTan[ b_] :> With[{min = Min[Abs[{m, n}]]}, Sign[m] (Abs[m] - min) ArcTan[a] + Sign[n] (Abs[n] - min) ArcTan[b] + min ArcTan[(Sign[m] a + Sign[n] b)/(1 - Sign[m n] a b)]]}; – auxsvr Jul 15 '14 at 12:46
  • @auxsvr Yes, using Abs was my first thought. Fixed the a to a_ -- I had thought about it before, but it was late. Can't think why I went for the literal a in the first place. – Michael E2 Jul 15 '14 at 13:30
  • @auxsvr You can clean up a bit via MinimalBy (v10): m_. ArcTan[a_] + n_. ArcTan[b_] :> With[{min = First@MinimalBy[{m, n}, Abs]}, (m - min) ArcTan[ a] + (n - min) ArcTan[b] + min ArcTan[(a + b)/(1 - a b)]] – evanb Jul 15 '14 at 17:28