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


Python Catalan.evalf方法代码示例

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


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

示例1: test_issue1512

# 需要导入模块: from sympy import Catalan [as 别名]
# 或者: from sympy.Catalan import evalf [as 别名]
def test_issue1512():
    assert abs(pi._evalf(50) - 3.14159265358979) < 1e-10
    assert abs(E._evalf(50) - 2.71828182845905) < 1e-10
    assert abs(Catalan._evalf(50) - 0.915965594177219) < 1e-10
    assert abs(EulerGamma._evalf(50) - 0.577215664901533) < 1e-10
    assert abs(GoldenRatio._evalf(50) - 1.61803398874989) < 1e-10
    x = Symbol("x")
    assert (pi+x).evalf() == pi.evalf()+x
    assert (E+x).evalf() == E.evalf()+x
    assert (Catalan+x).evalf() == Catalan.evalf()+x
    assert (EulerGamma+x).evalf() == EulerGamma.evalf()+x
    assert (GoldenRatio+x).evalf() == GoldenRatio.evalf()+x
开发者ID:101man,项目名称:sympy,代码行数:14,代码来源:test_numbers.py

示例2: test_fcode_NumberSymbol

# 需要导入模块: from sympy import Catalan [as 别名]
# 或者: from sympy.Catalan import evalf [as 别名]
def test_fcode_NumberSymbol():
    prec = 17
    p = FCodePrinter()
    assert fcode(Catalan) == '      parameter (Catalan = %sd0)\n      Catalan' % Catalan.evalf(prec)
    assert fcode(EulerGamma) == '      parameter (EulerGamma = %sd0)\n      EulerGamma' % EulerGamma.evalf(prec)
    assert fcode(E) == '      parameter (E = %sd0)\n      E' % E.evalf(prec)
    assert fcode(GoldenRatio) == '      parameter (GoldenRatio = %sd0)\n      GoldenRatio' % GoldenRatio.evalf(prec)
    assert fcode(pi) == '      parameter (pi = %sd0)\n      pi' % pi.evalf(prec)
    assert fcode(
        pi, precision=5) == '      parameter (pi = %sd0)\n      pi' % pi.evalf(5)
    assert fcode(Catalan, human=False) == (set(
        [(Catalan, p._print(Catalan.evalf(prec)))]), set([]), '      Catalan')
    assert fcode(EulerGamma, human=False) == (set([(EulerGamma, p._print(
        EulerGamma.evalf(prec)))]), set([]), '      EulerGamma')
    assert fcode(E, human=False) == (
        set([(E, p._print(E.evalf(prec)))]), set([]), '      E')
    assert fcode(GoldenRatio, human=False) == (set([(GoldenRatio, p._print(
        GoldenRatio.evalf(prec)))]), set([]), '      GoldenRatio')
    assert fcode(pi, human=False) == (
        set([(pi, p._print(pi.evalf(prec)))]), set([]), '      pi')
    assert fcode(pi, precision=5, human=False) == (
        set([(pi, p._print(pi.evalf(5)))]), set([]), '      pi')
开发者ID:normalhuman,项目名称:sympy,代码行数:24,代码来源:test_fcode.py

示例3: test_fcode_NumberSymbol

# 需要导入模块: from sympy import Catalan [as 别名]
# 或者: from sympy.Catalan import evalf [as 别名]
def test_fcode_NumberSymbol():
    assert fcode(Catalan) == '      parameter (Catalan = 0.915965594177219)\n      Catalan'
    assert fcode(EulerGamma) == '      parameter (EulerGamma = 0.577215664901533)\n      EulerGamma'
    assert fcode(E) == '      parameter (E = 2.71828182845905)\n      E'
    assert fcode(GoldenRatio) == '      parameter (GoldenRatio = 1.61803398874989)\n      GoldenRatio'
    assert fcode(pi) == '      parameter (pi = 3.14159265358979)\n      pi'
    assert fcode(pi,precision=5) == '      parameter (pi = 3.1416)\n      pi'
    assert fcode(Catalan,human=False) == ([('Catalan', Catalan.evalf(15))], set([]), '      Catalan')
    assert fcode(EulerGamma,human=False) == ([('EulerGamma', EulerGamma.evalf(15))], set([]), '      EulerGamma')
    assert fcode(E,human=False) == ([('E', E.evalf(15))], set([]), '      E')
    assert fcode(GoldenRatio,human=False) == ([('GoldenRatio', GoldenRatio.evalf(15))], set([]), '      GoldenRatio')
    assert fcode(pi,human=False) == ([('pi', pi.evalf(15))], set([]), '      pi')
    assert fcode(pi,precision=5,human=False) == ([('pi', pi.evalf(5))], set([]), '      pi')
开发者ID:tovrstra,项目名称:sympy,代码行数:15,代码来源:test_fcode.py

示例4: test_fcode_NumberSymbol

# 需要导入模块: from sympy import Catalan [as 别名]
# 或者: from sympy.Catalan import evalf [as 别名]
def test_fcode_NumberSymbol():
    p = FCodePrinter()
    assert fcode(Catalan) == '      parameter (Catalan = 0.915965594177219d0)\n      Catalan'
    assert fcode(EulerGamma) == '      parameter (EulerGamma = 0.577215664901533d0)\n      EulerGamma'
    assert fcode(E) == '      parameter (E = 2.71828182845905d0)\n      E'
    assert fcode(GoldenRatio) == '      parameter (GoldenRatio = 1.61803398874989d0)\n      GoldenRatio'
    assert fcode(pi) == '      parameter (pi = 3.14159265358979d0)\n      pi'
    assert fcode(pi,precision=5) == '      parameter (pi = 3.1416d0)\n      pi'
    assert fcode(Catalan,human=False) == (set([(Catalan, p._print(Catalan.evalf(15)))]), set([]), '      Catalan')
    assert fcode(EulerGamma,human=False) == (set([(EulerGamma, p._print(EulerGamma.evalf(15)))]), set([]), '      EulerGamma')
    assert fcode(E,human=False) == (set([(E, p._print(E.evalf(15)))]), set([]), '      E')
    assert fcode(GoldenRatio,human=False) == (set([(GoldenRatio, p._print(GoldenRatio.evalf(15)))]), set([]), '      GoldenRatio')
    assert fcode(pi,human=False) == (set([(pi, p._print(pi.evalf(15)))]), set([]), '      pi')
    assert fcode(pi,precision=5,human=False) == (set([(pi, p._print(pi.evalf(5)))]), set([]), '      pi')
开发者ID:Jerryy,项目名称:sympy,代码行数:16,代码来源:test_fcode.py


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