You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both ComplexFloat and ComplexDouble classes contain wrong implementation of arg().
E.g.
public float arg() {
return (float) Math.atan2(r, i);
}
must be replaced with
public float arg() {
return (float) Math.atan2(i, r);
}
exp(ix) = cos(x) + i*sin(x). atan2(y, x) = arctan(y/x) for non-zero x. So to get x = arg(exp(ix)), you need to take atan2(im(exp(ix)), re(exp(ix))) = atan2(sin(x), cos(x)) = arctan(tan(x)) = x (for x in proper range).
The text was updated successfully, but these errors were encountered:
Both ComplexFloat and ComplexDouble classes contain wrong implementation of
arg()
.E.g.
must be replaced with
exp(ix) = cos(x) + i*sin(x)
.atan2(y, x) = arctan(y/x)
for non-zero x. So to getx = arg(exp(ix))
, you need to takeatan2(im(exp(ix)), re(exp(ix))) = atan2(sin(x), cos(x)) = arctan(tan(x)) = x
(for x in proper range).The text was updated successfully, but these errors were encountered: