python反正切_python numpy np.arctan2()函数(批量计算反正切?)
发布日期:2021-06-24 11:28:26 浏览次数:3 分类:技术文章

本文共 3541 字,大约阅读时间需要 11 分钟。

def arctan2(x1, x2, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__

"""

arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])

Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.

元素方面的``X1 / x2``正确地选择象限反正切。

The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is

the signed angle in radians between the ray ending at the origin and

passing through the point (1,0), and the ray ending at the origin and

passing through the point (`x2`, `x1`).  (Note the role reversal: the

"`y`-coordinate" is the first function parameter, the "`x`-coordinate"

is the second.)  By IEEE convention, this function is defined for

`x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see

Notes for specific values).

选择象限(即分支),以使“ arctan2(x1,x2)”是从原点结束并通过点(1,0)的射线与在结束点的射线之间的弧度的符号角 原点并经过点(`x2`,`x1`)。 (请注意角色反转:“ y”坐标是第一个函数参数,“ x”坐标是第二个函数参数。)按照IEEE惯例,此函数定义为“ x2” = +/- 0 并且对于“ x1”和“ x2”中的一个或两个都= +/- inf(有关具体值,请参见注释)。

This function is not defined for complex-valued arguments; for the

so-called argument of complex values, use `angle`.

没有为复数值参数定义此函数; 对于所谓的复数值参数,请使用“ angle”。

Parameters

----------

x1 : array_like, real-valued

`y`-coordinates.y坐标。

x2 : array_like, real-valued

`x`-coordinates. `x2` must be broadcastable to match the shape of

`x1` or vice versa.

x坐标。 x2必须是可广播的,以匹配x1的形状,反之亦然。

out : ndarray, None, or tuple of ndarray and None, optional

A location into which the result is stored. If provided, it must have

a shape that the inputs broadcast to. If not provided or `None`,

a freshly-allocated array is returned. A tuple (possible only as a

keyword argument) must have length equal to the number of outputs.

结果存储的位置。 如果提供,它必须具有输入广播到的形状。 如果未提供或“无”,则返回一个新分配的数组。 元组(只能作为关键字参数)的长度必须等于输出的数量。

where : array_like, optional

Values of True indicate to calculate the ufunc at that position, values

of False indicate to leave the value in the output alone.

值为True表示要在该位置计算ufunc,值为False表示将值保留在输出中。

**kwargs

For other keyword-only arguments, see the

:ref:`ufunc docs `.

Returns

-------

angle : ndarray

Array of angles in radians, in the range ``[-pi, pi]``.

This is a scalar if both `x1` and `x2` are scalars.

弧度的角度数组,范围为“ [-pi,pi]”。

如果x1和x2均为标量,则为标量。

See Also

--------

arctan, tan, angle

Notes

-----

*arctan2* is identical to the `atan2` function of the underlying

C library.  The following special values are defined in the C

standard: [1]_

* arctan2 *与基础C库的`atan2`函数相同。 在C标准中定义了以下特殊值:[1] _

====== ====== ================

`x1`   `x2`   `arctan2(x1,x2)`

====== ====== ================

+/- 0  +0     +/- 0

+/- 0  -0     +/- pi

> 0   +/-inf +0 / +pi

< 0   +/-inf -0 / -pi

+/-inf +inf   +/- (pi/4)

+/-inf -inf   +/- (3*pi/4)

====== ====== ================

Note that +0 and -0 are distinct floating point numbers, as are +inf

and -inf.

请注意,+ 0和-0是不同的浮点数,+ inf和-inf也是如此。

References

----------

.. [1] ISO/IEC standard 9899:1999, "Programming language C."

Examples

--------

Consider four points in different quadrants:

考虑不同象限中的四个点

>>> x = np.array([-1, +1, +1, -1])

>>> y = np.array([-1, -1, +1, +1])

>>> np.arctan2(y, x) * 180 / np.pi

array([-135.,  -45.,   45.,  135.])

Note the order of the parameters. `arctan2` is defined also when `x2` = 0

and at several other special points, obtaining values in

the range ``[-pi, pi]``:

注意参数的顺序。 当`x2` = 0且在其他几个特殊点时,也定义了`arctan2`,获得的值在[-pi,pi]范围内:

>>> np.arctan2([1., -1.], [0., 0.])

array([ 1.57079633, -1.57079633])

>>> np.arctan2([0., 0., np.inf], [+0., -0., np.inf])

array([ 0.        ,  3.14159265,  0.78539816])

"""

pass

转载地址:https://blog.csdn.net/weixin_32503531/article/details/112959242 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:什么是十六进制法_十六进制计算方法是什么?
下一篇:python的matplotlib库_python matplotlib库的使用

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月13日 08时56分22秒