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


Python functions.euler函数代码示例

本文整理汇总了Python中sympy.functions.euler函数的典型用法代码示例。如果您正苦于以下问题:Python euler函数的具体用法?Python euler怎么用?Python euler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_euler_polynomials

def test_euler_polynomials():
    assert euler(0, x) == 1
    assert euler(1, x) == x - Rational(1, 2)
    assert euler(2, x) == x**2 - x
    assert euler(3, x) == x**3 - (3*x**2)/2 + Rational(1, 4)
    m = Symbol('m')
    assert isinstance(euler(m, x), euler)
    from sympy import Float
    A = Float('-0.46237208575048694923364757452876131e8')  # from Maple
    B = euler(19, S.Pi.evalf(32))
    assert abs((A - B)/A) < 1e-31  # expect low relative error
    C = euler(19, S.Pi, evaluate=False).evalf(32)
    assert abs((A - C)/A) < 1e-31
开发者ID:Lenqth,项目名称:sympy,代码行数:13,代码来源:test_comb_numbers.py

示例2: test_euler_failing

def test_euler_failing():
    # depends on dummy variables being implemented https://github.com/sympy/sympy/issues/5665
    assert euler(2*n).rewrite(Sum) == I*Sum(Sum((-1)**_j*2**(-_k)*I**(-_k)*(-2*_j + _k)**(2*n + 1)*binomial(_k, _j)/_k, (_j, 0, _k)), (_k, 1, 2*n + 1))
开发者ID:DVNSarma,项目名称:sympy,代码行数:3,代码来源:test_comb_numbers.py

示例3: test_euler

def test_euler():
    assert euler(0) == 1
    assert euler(1) == 0
    assert euler(2) == -1
    assert euler(3) == 0
    assert euler(4) == 5
    assert euler(6) == -61
    assert euler(8) == 1385

    assert euler(20, evaluate=False) != 370371188237525

    n = Symbol('n', integer=True)
    assert euler(n) != -1
    assert euler(n).subs(n, 2) == -1

    assert euler(20).evalf() == 370371188237525.0
    assert euler(20, evaluate=False).evalf() == 370371188237525.0

    assert euler(n).rewrite(Sum) == euler(n)
    # XXX: Not sure what the guy who wrote this test was trying to do with the _j and _k stuff
    assert euler(2*n + 1).rewrite(Sum) == 0
开发者ID:DVNSarma,项目名称:sympy,代码行数:21,代码来源:test_comb_numbers.py

示例4: test_issue_8496

def test_issue_8496():
    n = Symbol("n")
    k = Symbol("k")

    raises(TypeError, lambda: catalan(n, k))
    raises(TypeError, lambda: euler(n, k))
开发者ID:A-turing-machine,项目名称:sympy,代码行数:6,代码来源:test_comb_numbers.py

示例5: test_euler_polynomial_rewrite

def test_euler_polynomial_rewrite():
    m = Symbol('m')
    A = euler(m, x).rewrite('Sum');
    assert A.subs({m:3, x:5}).doit() == euler(3, 5)
开发者ID:Lenqth,项目名称:sympy,代码行数:4,代码来源:test_comb_numbers.py

示例6: test_euler_odd

def test_euler_odd():
    n = Symbol('n', odd=True, positive=True)
    assert euler(n) == 0
    n = Symbol('n', odd=True)
    assert euler(n) != 0
开发者ID:Lenqth,项目名称:sympy,代码行数:5,代码来源:test_comb_numbers.py


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