当前位置: 首页>>代码示例>>Python>>正文


Python cmath.tan方法代码示例

本文整理汇总了Python中cmath.tan方法的典型用法代码示例。如果您正苦于以下问题:Python cmath.tan方法的具体用法?Python cmath.tan怎么用?Python cmath.tan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmath的用法示例。


在下文中一共展示了cmath.tan方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TAN

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import tan [as 别名]
def TAN(df, price='Close'):
    """
    Tangent
    Returns: list of floats = jhta.TAN(df, price='Close')
    """
    return [cmath.tan(df[price][i]).real for i in range(len(df[price]))] 
开发者ID:joosthoeks,项目名称:jhTAlib,代码行数:8,代码来源:math_functions.py

示例2: test_tan

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import tan [as 别名]
def test_tan(self):
        self.assertAlmostEqual(complex(-0.000187346, 0.999356),
                               cmath.tan(complex(3, 4))) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:5,代码来源:test_cmath_jy.py

示例3: test_trig_hyperb_basic

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import tan [as 别名]
def test_trig_hyperb_basic():
    for x in (list(range(100)) + list(range(-100,0))):
        t = x / 4.1
        assert cos(mpf(t)).ae(math.cos(t))
        assert sin(mpf(t)).ae(math.sin(t))
        assert tan(mpf(t)).ae(math.tan(t))
        assert cosh(mpf(t)).ae(math.cosh(t))
        assert sinh(mpf(t)).ae(math.sinh(t))
        assert tanh(mpf(t)).ae(math.tanh(t))
    assert sin(1+1j).ae(cmath.sin(1+1j))
    assert sin(-4-3.6j).ae(cmath.sin(-4-3.6j))
    assert cos(1+1j).ae(cmath.cos(1+1j))
    assert cos(-4-3.6j).ae(cmath.cos(-4-3.6j)) 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:15,代码来源:test_functions.py

示例4: test_complex_functions

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import tan [as 别名]
def test_complex_functions():
    for x in (list(range(10)) + list(range(-10,0))):
        for y in (list(range(10)) + list(range(-10,0))):
            z = complex(x, y)/4.3 + 0.01j
            assert exp(mpc(z)).ae(cmath.exp(z))
            assert log(mpc(z)).ae(cmath.log(z))
            assert cos(mpc(z)).ae(cmath.cos(z))
            assert sin(mpc(z)).ae(cmath.sin(z))
            assert tan(mpc(z)).ae(cmath.tan(z))
            assert sinh(mpc(z)).ae(cmath.sinh(z))
            assert cosh(mpc(z)).ae(cmath.cosh(z))
            assert tanh(mpc(z)).ae(cmath.tanh(z)) 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:14,代码来源:test_functions.py

示例5: test_perturbation_rounding

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import tan [as 别名]
def test_perturbation_rounding():
    mp.dps = 100
    a = pi/10**50
    b = -pi/10**50
    c = 1 + a
    d = 1 + b
    mp.dps = 15
    assert exp(a) == 1
    assert exp(a, rounding='c') > 1
    assert exp(b, rounding='c') == 1
    assert exp(a, rounding='f') == 1
    assert exp(b, rounding='f') < 1
    assert cos(a) == 1
    assert cos(a, rounding='c') == 1
    assert cos(b, rounding='c') == 1
    assert cos(a, rounding='f') < 1
    assert cos(b, rounding='f') < 1
    for f in [sin, atan, asinh, tanh]:
        assert f(a) == +a
        assert f(a, rounding='c') > a
        assert f(a, rounding='f') < a
        assert f(b) == +b
        assert f(b, rounding='c') > b
        assert f(b, rounding='f') < b
    for f in [asin, tan, sinh, atanh]:
        assert f(a) == +a
        assert f(b) == +b
        assert f(a, rounding='c') > a
        assert f(b, rounding='c') > b
        assert f(a, rounding='f') < a
        assert f(b, rounding='f') < b
    assert ln(c) == +a
    assert ln(d) == +b
    assert ln(c, rounding='c') > a
    assert ln(c, rounding='f') < a
    assert ln(d, rounding='c') > b
    assert ln(d, rounding='f') < b
    assert cosh(a) == 1
    assert cosh(b) == 1
    assert cosh(a, rounding='c') > 1
    assert cosh(b, rounding='c') > 1
    assert cosh(a, rounding='f') == 1
    assert cosh(b, rounding='f') == 1 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:45,代码来源:test_functions.py


注:本文中的cmath.tan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。