Hi All,

Anyone knows of a trig identity between the arc tangent of an angle and it's multiples, like:

arctan(2x) = function of arctan(x)

Thanks!

Namir

PS: I have found a polynomial approximation by Eurler to calculate arctan very accurately, but I require tens of thousands of terms!!!!! Ouch!

Used WolframAlpha with:

Taylor[arctan[2*tan[y]],y]

The result is:

2 y-2 y^3+4 y^5-(142 y^7)/15+(4612 y^9)/189-(312644 y^11)/4725+O(y^12)

But that's probably not what you are looking for: a simple formula.

HTH

Thomas

If you do it with the inverse order of the functions:

Taylor[tan[2*arctan[y]],y]

The result is:

2 y+2 y^3+2 y^5+2 y^7+2 y^9+2 y^11+O(y^12)

(converges when abs(y)<1)

This geometric series leads to the well known result:

*Edited: 3 Mar 2013, 1:08 p.m. *

I am looking for an equation that is similar to the one for tan(2x) but expressed in terms of arctan(2x) and arctan(x).

I have a good Pade Approximant for tan(x). Ultimately, I can can use the Pade approximant for tan(x) in an iterative process. That would still be much faster than calculating 3000 to 4000 terms in a slow converging polynomial.

Namir

*Edited: 3 Mar 2013, 4:22 p.m. *

Quote:

I am looking for an equation that is similar to the one for tan(2x) but expressed in terms of arctan(2x) and arctan(x).

This doesn't appear to be possible. From the identity #1 here I've obtained

and

None of which will serve your purpose, though.

_{Edited to correct a typo in the second equation}

*Edited: 3 Mar 2013, 7:07 p.m. *

It may not be clear from my answer but the solution is:

arctan(2x) = 2 arctan(x) - 2 arctan^{3}(x) + 4 arctan^{5}(x) + ...

This is not the formula you are looking for but its Taylor expansion. So all you need to do is find a closed formula of this series. I didn't made any attempts to find it but just from looking at the coefficients of the higher orders I doubt that there is any.

It's not that you can expect that there is a closed formula in general. In the case of tan(x) it is related to the multiplication of complex numbers.

Sorry for the bad news.

Cheers

Thomas

I found the following useful identity:

arctan(x) = pi/2 - arctan(1/x)

This identity allows me to calculate the arctan for high values (just below 90 degrees) by calculating the arctan of 1/x.

I can calculate arctan with good accuracy for low x values using polynomial approximations or iteratively. Either way, I get good results for high x values!

Namir

*Edited: 4 Mar 2013, 7:22 a.m. *

I found an efficient algorithm to calculate arctan(x).

EPS = 1e-8

A1 = 1/SQRT(1+x*x)

B1 = 1
Do

A0 = A1

B0 = B1

A1 = (A0+B0)/2

B1 = SQRT(A1*B0)

Loop until |A1-A0|<=EPS and |B1-B0|<=EPS

arctan(x) = x/(SQRT(1+x*x)*A1)

Algorithm works as efficiently for small and large values of x. Number of iterations for the above loop range from 11 to 15.

*Edited: 4 Mar 2013, 11:08 a.m. *

Without coding and testing anything, I wonder if the difference is significant. The AGM converges pretty quickly which would mean A0 -> A1.

- Pauli

A quick check and they do converge different after all.

- Pauli

The CORDIC algorithm is another efficient way of computing arctangents with few iterations, but it requires a precomputed table of coefficients.

In another post you mentioned wanting the arctan of high values. If what you need is the angle given an x and y coordinate, i.e., the atan2(y,x) function, CORDIC is very good for that as well, since you don't have to do the y/x division, which can lose a lot of precision.

That's the same algorithm I found on the Wolfram web site. It works well even for large values of x. There is no need to use the trick:

arctan(x) = pi/2 - arctan(1/x)

Namir

*Edited: 4 Mar 2013, 11:09 p.m. *