mgamito
- 7
- 0
I need to compute the addition of four arctangents:
\alpha = \arctan(x_1) + \arctan(x_2) + \arctan(x_3) + \arctan(x_4)
Rather than call four arctangent functions, I was thinking of using the arctangent addition formula:
\arctan(u) + \arctan(v) = \arctan(\frac{u + v}{1 - uv}) + \pi n, for some n \in N
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 n throughout so that the result is correct.
My initial variables x_1 to x_4 are all positive so the result should be an angle 0 \leq \alpha < 2\pi. I suspect the answer lies in keeping track of the sign of the 1 - uv denominators and introducing some factor of \pi 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,
manuel
\alpha = \arctan(x_1) + \arctan(x_2) + \arctan(x_3) + \arctan(x_4)
Rather than call four arctangent functions, I was thinking of using the arctangent addition formula:
\arctan(u) + \arctan(v) = \arctan(\frac{u + v}{1 - uv}) + \pi n, for some n \in N
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 n throughout so that the result is correct.
My initial variables x_1 to x_4 are all positive so the result should be an angle 0 \leq \alpha < 2\pi. I suspect the answer lies in keeping track of the sign of the 1 - uv denominators and introducing some factor of \pi 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,
manuel