本文整理汇总了Python中sympy.polys.domains.RR.convert方法的典型用法代码示例。如果您正苦于以下问题:Python RR.convert方法的具体用法?Python RR.convert怎么用?Python RR.convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.polys.domains.RR
的用法示例。
在下文中一共展示了RR.convert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_RealField_from_sympy
# 需要导入模块: from sympy.polys.domains import RR [as 别名]
# 或者: from sympy.polys.domains.RR import convert [as 别名]
def test_RealField_from_sympy():
assert RR.convert(S(0)) == RR.dtype(0)
assert RR.convert(S(0.0)) == RR.dtype(0.0)
assert RR.convert(S(1)) == RR.dtype(1)
assert RR.convert(S(1.0)) == RR.dtype(1.0)
assert RR.convert(sin(1)) == RR.dtype(sin(1).evalf())
assert RR.convert(oo) == RR("+inf")
assert RR.convert(-oo) == RR("-inf")
raises(CoercionFailed, lambda: RR.convert(x))
示例2: test_RealDomain_from_sympy
# 需要导入模块: from sympy.polys.domains import RR [as 别名]
# 或者: from sympy.polys.domains.RR import convert [as 别名]
def test_RealDomain_from_sympy():
RR = RR_mpmath()
assert RR.convert(S(0)) == RR.dtype(0)
assert RR.convert(S(0.0)) == RR.dtype(0.0)
assert RR.convert(S(1)) == RR.dtype(1)
assert RR.convert(S(1.0)) == RR.dtype(1.0)
assert RR.convert(sin(1)) == RR.dtype(sin(1).evalf())
raises(CoercionFailed, lambda: RR.convert(x))
raises(CoercionFailed, lambda: RR.convert(oo))
raises(CoercionFailed, lambda: RR.convert(-oo))
示例3: test_RealDomain_from_sympy
# 需要导入模块: from sympy.polys.domains import RR [as 别名]
# 或者: from sympy.polys.domains.RR import convert [as 别名]
def test_RealDomain_from_sympy():
RR = RR_mpmath()
assert RR.convert(S(0)) == RR.dtype(0)
assert RR.convert(S(0.0)) == RR.dtype(0.0)
assert RR.convert(S(1)) == RR.dtype(1)
assert RR.convert(S(1.0)) == RR.dtype(1.0)
assert RR.convert(sin(1)) == RR.dtype(sin(1).evalf())
raises(CoercionFailed, "RR.convert(x)")
raises(CoercionFailed, "RR.convert(oo)")
raises(CoercionFailed, "RR.convert(-oo)")
RR = RR_sympy()
assert RR.convert(S(0)) == RR.dtype(0)
assert RR.convert(S(0.0)) == RR.dtype(0.0)
assert RR.convert(S(1)) == RR.dtype(1)
assert RR.convert(S(1.0)) == RR.dtype(1.0)
assert RR.convert(sin(1)) == RR.dtype(sin(1).evalf())
assert RR.n(3, 2) == RR.evalf(3, 2) == Rational(3).n(2)
raises(CoercionFailed, "RR.convert(x)")
raises(CoercionFailed, "RR.convert(oo)")
raises(CoercionFailed, "RR.convert(-oo)")