## `arg` -- the argument (polar angle) of a complex number

#### Introduction

`arg``(x, y)` returns the argument of the complex number with real part `x` and imaginary part `y`.

#### Call(s)

`arg(x, y)`

#### Parameters

`x, y` | - | arithmetical expressions representing real numbers

#### Returns

an arithmetical expression.

### Overloadable:

`x`, `y`

#### Side Effects

When called with floating point arguments, the function is sensitive to the environment variable `DIGITS` which determines the numerical working precision.

#### Related Functions

`arctan`, `Im`, `Re`, `rectform`

#### Details

- The argument of a non-zero complex number z=x+I*y= |z|*exp(I*phi) is its real polar angle phi. `arg``(x,y)` represents the principal value -PI<phi<=PI. For x<>0, y<>0 it is given by

      arg(x,y)=arctan(y/x)+PI/2*sign(y)*(1-sign(x)).

- An error occurs if either one of the arguments `x`, `y` is a non-real numerical value. Symbolic arguments are assumed to be real.
- A floating point number is returned if both arguments are numerical and at least one of them is a floating point number.
- If the sign of the arguments can be determined, then the result is expressed in terms of `arctan`. Cf. example 2. Otherwise, an unevaluated call of `arg` is returned. Numerical factors are eliminated from the first argument. Cf. example 3.
- The call `arg(0,0)` returns `0`.
- An alternative representation is arg(x,y)=-I*ln(z/|z|)=-I*ln(sign(z)). Cf. example 4.

#### Example 1

We demonstrate some calls with exact and symbolic input data:

    >> arg(2, 3), arg(x, 4), arg(4, y), arg(x, y), arg(10, y + PI)

                                        / y \
          arctan(3/2), arg(x, 4), arctan| - |, arg(x, y),
                                        \ 4 /

                   / y    PI \
             arctan| -- + -- |
                   \ 10   10 /

    >> arg(x, infinity), arg(-infinity, 3), arg(-infinity, -3)

                                    PI
                                    --, PI, -PI
                                    2

Floating point values are computed for floating point arguments:

    >> arg(2.0, 3), arg(2, 3.0), arg(10.0^100, 10.0^(-100))

                       0.9827937233, 0.9827937233, 1.0e-200

#### Example 2

`arg` reacts to properties:

    >> assume(x > 0): assume(y < 0): arg(x, y)

                                          / y \
                                    arctan| - |
                                          \ x /

    >> assume(x < 0): assume(y > 0): arg(x, y)

                                            / y \
                                 PI + arctan| - |
                                            \ x /

    >> assume(x <> 0): arg(x, 3)

                          PI (1 - sign(x))         / 3 \
                          ---------------- + arctan| - |
                                 2                 \ x /

    >> unassume(x), unassume(y):

#### Example 3

Certain simplifications may occur in unevaluated calls. In particular, numerical factors are eliminated from the first argument:

    >> arg(3*x, 9*y), arg(-12*sqrt(2)*x, 12*y)

                                                 1/2
                           arg(x, 3 y), arg(- x 2   , y)

#### Example 4

Use `rewrite` to convert symbolic calls of `arg` to the logarithmic representation:

    >> rewrite(arg(x, y), ln)

                                    /   x + I y    \
                              - I ln| ------------ |
                                    \ abs(x + I y) /

#### Example 5

System functions such as `diff`, `float`, `limit`, or `series` handle expressions involving `arg`:

    >> diff(arg(x, y), x), float(arg(PI, ln(2)))

                                   y
                              - -------, 0.2171564814
                                 2    2
                                x  + y

    >> limit(arg(x, x^2/(1+x)), x = infinity)

                                        PI
                                        --
                                        4

    >> series(arg(x, x^2), x = 1, 4, Real)

                                         2          3
               PI   / x       \   (x - 1)    (x - 1)             4
               -- + | - - 1/2 | - -------- + -------- + O((x - 1) )
               4    \ 2       /      4          12

#### Changes

- used to be called `atan`

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000