- labels: --> 460522
res : logarc(atan2(y,x))$
rectform(res),y=1,x=-1;
=> -%pi/4
BUT
atan2(1,-1) => 3*%pi/4
The fix is to change the formula in $logarc and in
simpatan2. Currently, logarc(atan2(y,x)) => logarc(atan
(y/x)), which gives incorrect results as above.
This formula should be replaced by
-%i*log((y+%i*x)/sqrt(x^2+y^2))
Logged In: YES
user_id=28849
Isn't this formula also wrong? For y=1, x=-1, the formula
becomes -%i*log((1-%i)/sqrt(2)). But log is the principal
log so we still get -%pi/4.
I think it would be better to make atan2 be in the range
(-%pi,%pi].
Logged In: YES
user_id=28849
Oops. I think the formula was intended to be
-%i*log((x+%i*y)/sqrt(x^2+y^2)).
That produces the correct values. At least
factor(rectform(<formula>)) produces atan2(y/r,x/r) with r =
sqrt(x^2+y^2).
It would be nice if atan2 simplified out the denominator to
leave only atan2(y,x).
Logged In: YES
user_id=28849
Fixed as suggested, with slight correction.
Log in to post a comment.