arg
-- the argument (polar angle) of
a complex numberarg
(x, y)
returns the argument of the
complex number with real part x
and imaginary part
y
.
arg(x, y)
x, y |
- | arithmetical expressions representing real numbers |
an arithmetical expression.
x
, y
When called with floating point arguments, the function is sensitive
to the environment variable DIGITS
which determines the numerical
working precision.
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)).
x
,
y
is a non-real numerical value. Symbolic arguments are
assumed to be real.arctan
. Cf. example 2. Otherwise, an unevaluated call of arg
is
returned. Numerical factors are eliminated from the first argument. Cf.
example 3.arg(0,0)
returns 0
.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
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):
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)
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) /
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
atan