simplification of atan2



Curiously, maple10 does not evaluate arctan(x,x).

But the maple definition is better than that in the maxima manual.

It says that arctan(y,x) computes the principal value in (-%pi, %pi]
of the argument of x + %i*y

In this way, of course,  atan2(-1,-1) = - (3/4)*%pi and atan2(1,1) =
%pi/4

The definition in the maxima manual as the value of atan(y/x) is
ambiguous since both (-1/-1) and (1/1) = 1.

I suggest that, if changes are made then the definition in the maxima
manual should also be changed (at least with a reference to 'carg').

-sen


It also indicates how to extend it to the complex domain as

-%i * ln( (x + %i*y)/(x^2 + y^2)^(1/2) )





  On Sat, 21 Jul 2007, Stavros Macrakis wrote:

>> 
>> > (%i1) atan2(x,x);
>> > Is  x   positive or negative? pos;
>> Should it also ask if x is zero?
>
>
> In general, Maxima doesn't ask about isolated singularities.  Otherwise, it
> wouldn't simplify x/x => 1.  (There is a good argument for tagging the 1
> with "assuming that x#0, but of course we don't do that.) Of course, you
> could argue that the atan2 case is different since it is not continuous at
> (0,0), but if you restrict its domain to (pos,pos) or (neg,neg), it is
> continuous in each of those cases.
>
> Annoyingly, though, atan2(abs(x),abs(x)) *does* ask whether x is zero or
> non-zero, though atan2(x^2,x^2) does not.  Bizarrely, if you answer that
> x=0, it doesn't give the error that atan2(0,0) does, but blithely gives
> pi/4. And if atan2(x,x) asks a question to simplify, why doesn't
> atan2(x,2*x)?
>
>> Regardless of your opinion about asksign in general, it seems
>> > wrong for a simplification function to use asksign.
>
>
> Yes, I generally agree.  After all, abs(x) doesn't ask for the sign of x.
>
> We could
>> > change atan2 to use atan2(x,x) = (%pi/4) * (2 * signum(x) - 1).
>> > This is wrong for x = 0, x = %i, ... Suggestions?
>
>
> Mathematically OK, I guess, but probably not very useful.
>
>             -s
>

-- 
  ---------------------------------------------------------------------------
  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
  | Mathematics Department         |       				   |
  | Michigan State University      | telephone: 517-355-9684                |
  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
  ---------------------------------------------------------------------------