atan2与atan的区别

目录

总结

atan2: Four-quadrant inverse tangent.

atan

距离对比


总结

        简而言之,atan2与atan的区别体现在两个方面:

        (1) atan2接收两个输入参数;atan只接收一个输入参数

        (2) atan2对象限敏感,根据两个参数判断它是属于哪个象限并给出对应的角度值,值域范围[-pi, pi];atan对象限不敏感,值域范围为[-pi/2, pi/2]

atan2: Four-quadrant inverse tangent.

四象限反正切函数. Also known as the "quadrant-sensitive'' arctangent function。即atan2()是对象限敏感的,或者说atan2根据输入参数来确定所要求的目标角是在哪个象限,并由此给出合适的结果。

因此atan2()的值域是[-pi, pi]。也正因为atan2()需要确定目标角的象限,所以atan2的参数是以(y,x)的方式指定,因此atan2(y,x)与atan2(-y,-x)所给出的结果是不一样的,虽然(y/x) = ((-y)/(-x))。

atan

与之相对的是,atan(y/x)  like the more traditional mathematical notation

$ \tan^{-1}(y/x)$

does not ``know'' the quadrant of

$ (x,y)$

, so it maps the entire real line to the interval: [-\pi/2, \pi/2] .

这是说atan()是不关心象限,或者说对象限不敏感,它的值域[-pi/2, pi/2]。

atan的输入参数是一个数(表示y/x,而不是像atan2()那样指定两个数)也决定了它是无法“感知”象限的,原因恰好也在于:\frac{y}{x} = \frac{-y}{-x}

距离对比

所以,比如说,(x1,y1) = (3,4)和(x2,y2) = (-3,-4),用atan2来计算这两个坐标点的角度的话,结果是不一样的:

        atan2(4,3) = 0.9273

        atan2(-4,-3) = -2.2143 = 0.9273 - pi

两者之间恰好相差pi。

而用atan来求的话,就相等了。因为(4/3) = ((-4)/(-3)),atan无法区分两者。

reference:

[1] Four-quadrant inverse tangent - MATLAB atan2

[2] The Complex Plane

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

笨牛慢耕

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值