arctan with two arguments

arctan

with two arguments

When inverting the

polar coordinates

, one needs the
arc tan

function

(

http://planetmath.org/CyclometricFunctions

)

arctan

with two

arguments

.
If

(

x

,

y

)

∈

ℝ

2

∖

{

0

}

, then

arctan

⁡

(

x

,

y

)

is defined as the angle

(

x

,

y

)

makes with
the positive

x

-axis.

One usually sees expressions like

arctan

⁡

(

y

/

x

)

,
which is equal to

arctan

⁡

(

x

,

y

)

when

(

x

,

y

)

is in the first

quadrant

.
However,

arctan

⁡

(

y

/

x

)

does not give the correct angle when

(

x

,

y

)

is in the third quadrant (since

y

/

x

=

(

-

y

)

/

(

-

x

)

).
Also, the

quotient

y

/

x

involves a

division by zero

when

x

=

0

,
which is damaging both numerically and mathematically.

In most mathematical software and programming languages the two-argument

arctan

is directly implemented.

In Python

language

the functions

atan(x)

and

atan2(x,y)

are the respective one and two argument versions of

arctan

. The point of having the two argument version is to determine the correct quadrant of the point. For

instance

,

1

/

1

=

1

=

-

1

/

-

1

, so

atan(x)

cannot distinguish between

(

1

,

1

)

and

(

-

1

,

-

1

)

, but

atan2(x,y)

can, as the following Python code illustrates:

\PMlinkescapetext{
>>> from math import *
>>> print atan(1)
0.785398163397
>>> print atan2(1,1)
0.785398163397
>>> print atan2(-1,-1)
-2.3619449019
}

because

(

1

,

1

)

has argument

π

/

4

=

0.7853

⁢

…

but

(

-

1

,

-

1

)

has argument

-

3

⁢

π

/

4

=

-

2.3619

⁢

…

.

Analytic properties

In mathematical works,

arctan

⁡

(

x

,

y

)

is simply denoted by

θ

⁢

(

x

,

y

)

. The symbol

θ

obviously refers to the angle, but it is really
the function

h

2

, where

g

⁢

(

r

,

θ

)

=

(

r

⁢

cos

⁡

θ

,

r

⁢

sin

⁡

θ

)

,

h

⁢

(

x

,

y

)

=

g

-

1

⁢

(

x

,

y

)

=

(

r

,

θ

)

.

The function

g

:

ℝ

2

→

ℝ

2

is the polar-to-Cartesian

coordinate

transformation

.
By the

inverse function theorem

, the function

h

(the Cartesian-to-polar coordinate transformation) exists and is smooth wherever it is defined.
Note that

h

cannot be defined continuously everywhere, because of the

multi-valued

nature of

θ

—

(

r

,

θ

)

and

(

r

,

θ

+

2

⁢

π

⁢

n

)

always map to the same point under

g

.
(Similarly,

θ

cannot defined when

r

=

x

2

+

y

2

=

0

.)
This means, if one chases a loop (say a circle) around the origin,

θ

would move
from

0

to

2

⁢

π

, even though the image point

g

⁢

(

r

,

θ

)

winds back to the starting point.

Technically, a “largest” possible domain of

h

(and

θ

) can only be taken to be some simply connected open subset of

ℝ

2

∖

{

0

}

. (Note:

ℝ

2

∖

{

0

}

itself is not simply connected.)
For example, such a domain might be

ℝ

2

∖

{

(

x

,

y

)

:

x

≤

0

}

, i.e. delete the

negative real axis

from

ℝ

2

.

The exterior derivative of

θ

is

d

⁢

θ

=

-

y

x

2

+

y

2

⁢

d

⁢

x

+

x

x

2

+

y

2

⁢

d

⁢

y

,

(found by

implicit differentiation

),
and hence

∂

⁡

θ

∂

⁡

x

=

-

y

x

2

+

y

2

,

∂

⁡

θ

∂

⁡

y

=

x

x

2

+

y

2

(which can also be found by differentiating

arctan

⁡

(

y

/

x

)

directly
and piecing the results for each quadrant).

Of course, the

formulas

above are only valid wherever

θ

is defined,
but the analytical expressions do not change no matter which

domain of definition

is taken for

θ

.
This allows for the following neat formula
to find the

total variation

of angle of a smooth curve

γ

:

[

a

,

b

]

→

ℝ

2

∖

{

0

}

:

∫

γ

𝑑

θ

=

∫

a

b

γ

*

⁢

𝑑

θ

=

∫

a

b

(

-

y

⁢

x

˙

x

2

+

y

2

+

x

⁢

y

˙

x

2

+

y

2

)

⁢

𝑑

t

.

(This is related to the formula for the

winding number

and the

argument principle

in

complex analysis

.)

For example, if

γ

⁢

(

t

)

=

(

r

⁢

cos

⁡

t

,

r

⁢

sin

⁡

t

)

, for

t

∈

[

0

,

2

⁢

π

⁢

n

]

,
is the circle that winds around the origin

n

times, then

∫

γ

𝑑

θ

=

2

⁢

π

⁢

n

.

Title

arctan

with two arguments

Canonical name

operatornamearcTanWithTwoArguments

Date of creation

2013-03-22 15:18:19

Last modified on

2013-03-22 15:18:19

Owner

matte (1858)

Last modified by

matte (1858)

Numerical id

11

Author

matte (1858)

Entry type

Definition

Classification

msc 51M04

Classification

msc 51-01

Synonym

angle function

Generated on Fri Feb 9 22:04:35 2018 by

LaTeXML