From: SourceForge.net <no...@so...> - 2006-11-09 04:26:30
|
Bugs item #626721, was opened at 2002-10-22 03:15 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=626721&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core - Trigonometry Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: logarc of atan2 wrong Initial Comment: 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)) ---------------------------------------------------------------------- >Comment By: Raymond Toy (rtoy) Date: 2006-11-08 23:26 Message: 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). ---------------------------------------------------------------------- Comment By: Raymond Toy (rtoy) Date: 2006-11-08 23:13 Message: 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]. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=626721&group_id=4933 |