Arctangent

rspuzio

Joined Jan 19, 2009
77
To make life simpler, we can first restrict the range
to the case where the value lies between 0 and 1 by
using the identities

\( \arctan (-x) = \arctan (-x) \)

and

\( \arctan (x) = {\pi \over 2} -
\arctan \left( {1 \over x} \right) \).

Note that these formulae, and the ones to follow all
give the arc tangent in radians so, if you want degrees,
you will have to convert the answer.

If we only need limited accuracy, a rational approximation
is the way to go. The following formula is accurate to
two decimal places:

\( \arctan x \approx {x \over 1 + 0.28 x^2} \)

Converting to degrees, we have the following:

\( \arctan x ({\rm degrees}) \approx {57 x \over 1
+ 0.28 x^2} ,\)

which gives the answer to within a degree.

If we want five-place accuracy, there is the following
polynomial approximation:

\( \arctan x \approx 0.999,866,0 x - 0.330,299,5 x^3 +
0.180,141,0 x^5 - 0.085,133,0 x^7 + 0.020,835,1 x^9 \)

This should be good enough for all but the most demanding
applications but, if we want arbitrary precision, we could use
the following series expansion which has nice convergence
properties throughout the range of \(x\):

\( \arctan x = {x \over 1 + x^2} \.
\left( 1 + {2 \over 3} \cdot {x^2 \over 1 + x^2}
+ {2 \cdot 4 \over 3 \cdot 5} \cdot
\left( {x^2 \over 1 + x^2} \right)^2
+ {2 \cdot 4 \cdot 6 \over 3 \cdot 5 \cdot 7} \cdot
\left( {x^2 \over 1 + x^2} \right)^3
+ \cdots \right) \)

Also, for the purpose of numerical computation, this
series folds up quite nicely:

\( \arctan x = {x \over 1 + x^2}
\left( 1 + {2 \over 3} \cdot {x^2 \over 1 + x^2}
\left( 1 + {4 \over 5} \cdot {x^2 \over 1 + x^2}
\left( 1 + {6 \over 7} \cdot {x^2 \over 1 + x^2}
\left( 1 + \cdots \right) \right) \right) \right) \)

Because the terms in this series are all positive, it
has the "Price is Right" property --- it will estimate
the value as closely as you want without ever going over.

Let's illustrate this by computing the arc tangent of -3.
Using our identities, we see that

\( \arctan (-3) = - \arctan (3) =
\arctan \left( {1 \over 3} \right)- {\pi \over 2} \)

so we'll first compute the arc tangent of a third, then
go back and turn that into the arctangent of minus three.
(See the other thread for a debate over whether I should
have said "negative three" instead. :eek:)

By our rough-and-dirty approximation:

\( \arctan \left( {1 \over 3} \right) \approx
{0.33 \over 1 + 0.28 (0.33)^2} \approx 0.32 \)

or, in degrees,

\( \arctan \left( {1 \over 3} \right) \approx
{57 \cdot 0.33 \over 1 + 0.28 (0.33)^2}
\approx 19^{\circ} . \)

Using the polynomial approximation,

\( \begin{align}
\arctan \left( {1 \over 3} \right) &\approx
0.999,866,0 (0.333,333,3)
- 0.330,299,5 (0.333,333,3)^3
+ 0.180,141,0 (0.333,333,3)^5 \\
&- 0.085,133,0 (0.333,333,3)^7
+ 0.020,835,1 (0.333,333,3)^9 \\
&\approx 0.321,758,8 \end{align} .\)

Finally, the series becomes

\( \arctan \left( {1 \over 3} \right) =
{3 \over 10} \left(
1
+ {2 \over 3} \cdot {1 \over 10}
+ {8 \over 15} \cdot \left( {1 \over 10} \right)^2
+ {48 \over 105} \cdot \left( {1 \over 10} \right)^3
+ {384 \over 945} \cdot \left( {1 \over 10} \right)^4
+ {3840 \over 10395} \cdot \left( {1 \over 10} \right)^5
+ {46080 \over 135135} \cdot \left( {1 \over 10} \right)^6
+ \cdots \right) \)

As we see from the powers of a tenth, we will gain at least a
decimal place of accuracy for each extra term we include.
Computing the successive terms numerically, we get the
following approximations.

0.300,000,000
0.320,000,000
0.321,600,000
0.321,737,142
0.321,749,333
0.321,750,441
0.321,750,543
. . . . . . .

So we're good to seven decimal places so far and have our
best value so far, \( \arctan (1/3) = 0.321,750,5 \cdots \).
In particular, comparing with this, we see that the polynomial
approximation is good to five decimal places, as advertised.
Subtracting the pi, we get

\( \arctan (-3) = \arctan (1/3) - \pi/2 = -1.249,045,7 \cdots \)

Converting into degrees,

\( \arctan (1/3) = 18.434,948^{\circ}\)
\( \arctan (-3) = -71.565,051^{\circ}\)

or, in the good old Babylonian notation,
\( \arctan (1/3) = 18^{\circ} 26' 6'' \)
\( \arctan (-3) = -71^{\circ} 33' 54'' .\)

Alright, lesson over, now go compute some angles :)
 
Last edited:

KL7AJ

Joined Nov 4, 2008
2,229
Firstly, it's "arc tangent", not "arch tangent".

To make life simpler, we can first restrict the range
to the case where the value lies between 0 and 1 by
using the identities

\( \arctan (-x) = \arctan (-x) \)

and

\( \arctan (x) = {\pi \over 2} -
\arctan \left( {1 \over x} \right) \).

Note that these formulae, and the ones to follow all
give the arc tangent in radians so, if you want degrees,
you will have to convert the answer.

If we only need limited accuracy, a rational approximation
is the way to go. The following formula is accurate to
two decimal places:

\( \arctan x \approx {x \over 1 + 0.28 x^2} \)

Converting to degrees, we have the following:

\( \arctan x ({\rm degrees}) \approx {57 x \over 1
+ 0.28 x^2} ,\)

which gives the answer to within a degree.

If we want five-place accuracy, there is the following
polynomial approximation:

\( \arctan x \approx 0.999,866,0 x - 0.330,299,5 x^3 +
0.180,141,0 x^5 - 0.085,133,0 x^7 + 0.020,835,1 x^9 \)

This should be good enough for all but the most demanding
applications but, if we want arbitrary precision, we could use
the following series expansion which has nice convergence
properties throughout the range of \(x\):

\( \arctan x = {x \over 1 + x^2} \.
\left( 1 + {2 \over 3} \cdot {x^2 \over 1 + x^2}
+ {2 \cdot 4 \over 3 \cdot 5} \cdot
\left( {x^2 \over 1 + x^2} \right)^2
+ {2 \cdot 4 \cdot 6 \over 3 \cdot 5 \cdot 7} \cdot
\left( {x^2 \over 1 + x^2} \right)^3
+ \cdots \right) \)

Also, for the purpose of numerical computation, this
series folds up quite nicely:

\( \arctan x = {x \over 1 + x^2}
\left( 1 + {2 \over 3} \cdot {x^2 \over 1 + x^2}
\left( 1 + {4 \over 5} \cdot {x^2 \over 1 + x^2}
\left( 1 + {6 \over 7} \cdot {x^2 \over 1 + x^2}
\left( 1 + \cdots \right) \right) \right) \right) \)

Let's illustrate this by computing the arc tangent of -3.
Using our identities, we see that

\( \arctan (-3) = - \arctan (3) =
\arctan \left( {1 \over 3} \right)- {\pi \over 2} \)

so we'll first compute the arc tangent of a third, then
go back and turn that into the arctangent of minus three.
(See the other thread for a debate over whether I should
have said "negative three" instead. :eek:)

By our rough-and-dirty approximation:

\( \arctan \left( {1 \over 3} \right) \approx
{0.33 \over 1 + 0.28 (0.33)^2} \approx 0.32 \)

or, in degrees,

\( \arctan \left( {1 \over 3} \right) \approx
{57 \cdot 0.33 \over 1 + 0.28 (0.33)^2}
\approx 19^{\circ} . \)

Using the polynomial approximation,

\( \begin{align}
\arctan \left( {1 \over 3} \right) &\approx
0.999,866,0 (0.333,333,3)
- 0.330,299,5 (0.333,333,3)^3
+ 0.180,141,0 (0.333,333,3)^5 \\
&- 0.085,133,0 (0.333,333,3)^7
+ 0.020,835,1 (0.333,333,3)^9 \\
&\approx 0.321,758,8 \end{align} .\)

Finally, the series becomes

\( \arctan \left( {1 \over 3} \right) =
{3 \over 10} \left(
1
+ {2 \over 3} \cdot {1 \over 10}
+ {8 \over 15} \cdot \left( {1 \over 10} \right)^2
+ {48 \over 105} \cdot \left( {1 \over 10} \right)^3
+ {384 \over 945} \cdot \left( {1 \over 10} \right)^4
+ {3840 \over 10395} \cdot \left( {1 \over 10} \right)^5
+ {46080 \over 135135} \cdot \left( {1 \over 10} \right)^6
+ \cdots \right) \)

As we see from the powers of a tenth, we will gain at least a
decimal place of accuracy for each extra term we include.
Computing the successive terms numerically, we get the
following approximations.

0.300,000,000
0.320,000,000
0.321,600,000
0.321,737,142
0.321,749,333
0.321,750,441
0.321,750,543
. . . . . . .

So we're good to seven decimal places so far and have our
best value so far, \( \arctan (1/3) = 0.321,750,5 \cdots \).
In particular, comparing with this, we see that the polynomial
approximation is good to five decimal places, as advertised.
Subtracting the pi, we get

\( \arctan (-3) = \arctan (1/3) - \pi/2 = -1.249,045,7 \cdots \)

Converting into degrees,

\( \arctan (1/3) = 18.434,948^{\circ}\)
\( \arctan (-3) = -71.565,051^{\circ}\)

or, in the good old Babylonian notation,
\( \arctan (1/3) = 18^{\circ} 26' 6'' \)
\( \arctan (-3) = -71^{\circ} 33' 54'' .\)

Alright, lesson over, now go compute some angles :)
Smart@$$ !! :D


Eric
 
Top