1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to add four arctangents efficiently

  1. May 3, 2013 #1
    I need to compute the addition of four arctangents:

    [itex]\alpha = \arctan(x_1) + \arctan(x_2) + \arctan(x_3) + \arctan(x_4) [/itex]

    Rather than call four arctangent functions, I was thinking of using the arctangent addition formula:

    [itex]\arctan(u) + \arctan(v) = \arctan(\frac{u + v}{1 - uv}) + \pi n[/itex], for some [itex]n \in N[/itex]

    I could invoke the above property three times and I would only have to call the arctan function once. My problem is how to keep track of the integer [itex]n[/itex] throughout so that the result is correct.

    My initial variables [itex]x_1[/itex] to [itex]x_4[/itex] are all positive so the result should be an angle [itex]0 \leq \alpha < 2\pi[/itex]. I suspect the answer lies in keeping track of the sign of the [itex]1 - uv[/itex] denominators and introducing some factor of [itex]\pi[/itex] correction if they go negative.

    I'll work this through the weekend but I thought I would post this here in case someone figured this out already.

    Thank you,
  2. jcsd
  3. May 3, 2013 #2
  4. May 3, 2013 #3

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    If ##\arctan(x_1) + \arctan(x_2) = \arctan(y_1) + \pi n_1## and ##\arctan(x_3) + \arctan(x_4) = \arctan(y_2) + \pi n_2,## we then have ##\sum_{i=1}^4 \arctan(x_i) = \arctan(y_1) + \arctan(y_2) + \pi (n_1 + n_2),## which has the form ##\arctan(z) + \pi (n_1 + n_2 + n_3).## Here,
    [tex] z = \frac{y_1 + y_2}{1-y_1 y_2}.[/tex]
    We might as well just say that ##n_1 + n_2 + n_3 = n,## an integer.
    Last edited: May 3, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted