本文整理汇总了Python中numpy.core.umath.pi方法的典型用法代码示例。如果您正苦于以下问题:Python umath.pi方法的具体用法?Python umath.pi怎么用?Python umath.pi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.core.umath
的用法示例。
在下文中一共展示了umath.pi方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pi
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_pi(self):
assert_allclose(ncu.pi, 3.141592653589793, 1e-15)
示例2: test_one_one
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_one_one(self):
# atan2(1, 1) returns pi/4.
assert_almost_equal(ncu.arctan2(1, 1), 0.25 * np.pi)
assert_almost_equal(ncu.arctan2(-1, 1), -0.25 * np.pi)
assert_almost_equal(ncu.arctan2(1, -1), 0.75 * np.pi)
示例3: test_zero_nzero
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_zero_nzero(self):
# atan2(+-0, -0) returns +-pi.
assert_almost_equal(ncu.arctan2(np.PZERO, np.NZERO), np.pi)
assert_almost_equal(ncu.arctan2(np.NZERO, np.NZERO), -np.pi)
示例4: test_zero_negative
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_zero_negative(self):
# atan2(+-0, x) returns +-pi for x < 0.
assert_almost_equal(ncu.arctan2(np.PZERO, -1), np.pi)
assert_almost_equal(ncu.arctan2(np.NZERO, -1), -np.pi)
示例5: test_positive_zero
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_positive_zero(self):
# atan2(y, +-0) returns +pi/2 for y > 0.
assert_almost_equal(ncu.arctan2(1, np.PZERO), 0.5 * np.pi)
assert_almost_equal(ncu.arctan2(1, np.NZERO), 0.5 * np.pi)
示例6: test_any_ninf
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_any_ninf(self):
# atan2(+-y, -infinity) returns +-pi for finite y > 0.
assert_almost_equal(ncu.arctan2(1, np.NINF), np.pi)
assert_almost_equal(ncu.arctan2(-1, np.NINF), -np.pi)
示例7: test_inf_any
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_inf_any(self):
# atan2(+-infinity, x) returns +-pi/2 for finite x.
assert_almost_equal(ncu.arctan2( np.inf, 1), 0.5 * np.pi)
assert_almost_equal(ncu.arctan2(-np.inf, 1), -0.5 * np.pi)
示例8: test_inf_ninf
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_inf_ninf(self):
# atan2(+-infinity, -infinity) returns +-3*pi/4.
assert_almost_equal(ncu.arctan2( np.inf, -np.inf), 0.75 * np.pi)
assert_almost_equal(ncu.arctan2(-np.inf, -np.inf), -0.75 * np.pi)
示例9: test_inf_pinf
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_inf_pinf(self):
# atan2(+-infinity, +infinity) returns +-pi/4.
assert_almost_equal(ncu.arctan2( np.inf, np.inf), 0.25 * np.pi)
assert_almost_equal(ncu.arctan2(-np.inf, np.inf), -0.25 * np.pi)
示例10: test_degrees
# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import pi [as 别名]
def test_degrees(self):
assert_almost_equal(ncu.degrees(np.pi), 180.0)
assert_almost_equal(ncu.degrees(-0.5*np.pi), -90.0)