atan(x)
Return the arc tangent (measured in radians) of x.
math.atan2的docstring:
atan2(y, x)
Return the arc tangent (measured in radians) of y/x. Unlike atan(y/x),
the signs of both x and y are considered.
为了完整起见,以下是医生对atan2的看法:
math.atan2(y, x) Return atan(y / x), in radians. The result is between
-pi and pi. The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis. The point of atan2() is
that the signs of both inputs are known to it, so it can compute the
correct quadrant for the angle. For example, atan(1) and atan2(1, 1)
are both pi/4, but atan2(-1, -1) is -3*pi/4.
math.atan的docstring:
math.atan2的docstring:
为了完整起见,以下是医生对atan2的看法:
所以很明显:输出是不同的,因为有
ImZ
和ImR
的符号。atan2
返回适当的象限,与atan
不同。Atan采用单参数,Atan2采用两个参数。使用两个参数而不是一个参数的目的是收集有关输入符号的信息,以便返回计算角度的适当象限,这对于单参数Atan是不可能的
Atan2结果总是介于-pi和pi之间。
参考: https://en.wikipedia.org/wiki/Atan2
从0开始逆时针方向的角度,也就是x的正轴
对于x和y的任何值为2pi。对于x=y=0,结果未定义。
f(x,y)=pi()-pi()/2*(1+符号(x))*(1-符号(y^2))-pi()/4*(2+符号(x))*符号(y)
相关问题 更多 >
编程相关推荐