本文整理汇总了Python中sympy.polys.rootoftools.RootSum类的典型用法代码示例。如果您正苦于以下问题:Python RootSum类的具体用法?Python RootSum怎么用?Python RootSum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RootSum类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_RootSum_evalf
def test_RootSum_evalf():
rs = RootSum(x**2 + 1, exp)
assert rs.evalf(n=20, chop=True).epsilon_eq(Float("1.0806046117362794348", 20), Float("1e-20")) == True
assert rs.evalf(n=15, chop=True).epsilon_eq(Float("1.08060461173628", 15), Float("1e-15")) == True
rs = RootSum(x**2 + a, exp, x)
assert rs.evalf() == rs
开发者ID:BDGLunde,项目名称:sympy,代码行数:9,代码来源:test_rootoftools.py
示例2: test_RootSum_doit
def test_RootSum_doit():
rs = RootSum(x**2 + 1, exp)
assert isinstance(rs, RootSum) is True
assert rs.doit() == exp(-I) + exp(I)
rs = RootSum(x**2 + a, exp, x)
assert isinstance(rs, RootSum) is True
assert rs.doit() == exp(-sqrt(-a)) + exp(sqrt(-a))
开发者ID:Bercio,项目名称:sympy,代码行数:10,代码来源:test_rootoftools.py
示例3: test_RootSum___new__
def test_RootSum___new__():
f = x**3 + x + 3
g = Lambda(r, log(r*x))
s = RootSum(f, g)
rootofs = sum(log(RootOf(f, i)*x) for i in (0, 1, 2))
assert isinstance(s, RootSum) == True
assert s.doit() == rootofs
assert RootSum(f**2, g) == 2*RootSum(f, g)
assert RootSum(f**2, g).doit() == 2*rootofs
assert RootSum((x - 7)*f**3, g) == log(7*x) + 3*RootSum(f, g)
assert RootSum((x - 7)*f**3, g).doit() == log(7*x) + 3*rootofs
# Issue 2472
assert hash(RootSum((x - 7)*f**3, g)) == hash(log(7*x) + 3*RootSum(f, g))
raises(MultivariatePolynomialError, "RootSum(x**3 + x + y)")
raises(ValueError, "RootSum(x**2 + 3, lambda x: x)")
assert RootSum(f, exp) == RootSum(f, Lambda(x, exp(x)))
assert RootSum(f, log) == RootSum(f, Lambda(x, log(x)))
assert isinstance(RootSum(f, auto=False), RootSum) == True
assert RootSum(f) == 0
assert RootSum(f, Lambda(x, x)) == 0
assert RootSum(f, Lambda(x, x**2)) == -2
assert RootSum(f, Lambda(x, 1)) == 3
assert RootSum(f, Lambda(x, 2)) == 6
assert RootSum(f, auto=False).is_commutative == True
assert RootSum(f, Lambda(x, 1/(x + x**2))) == S(11)/3
assert RootSum(f, Lambda(x, y/(x + x**2))) == S(11)/3*y
assert RootSum(x**2 - 1, Lambda(x, 3*x**2), x) == 6
assert RootSum(x**2 - y, Lambda(x, 3*x**2), x) == 6*y
assert RootSum(x**2 - 1, Lambda(x, z*x**2), x) == 2*z
assert RootSum(x**2 - y, Lambda(x, z*x**2), x) == 2*z*y
assert RootSum(x**2 - 1, Lambda(x, exp(x)), quadratic=True) == exp(-1) + exp(1)
assert RootSum(x**3 + a*x + a**3, tan, x) == RootSum(x**3 + x + 1, Lambda(x, tan(a*x)))
assert RootSum(a**3*x**3 + a*x + 1, tan, x) == RootSum(x**3 + x + 1, Lambda(x, tan(x/a)))
开发者ID:Jerryy,项目名称:sympy,代码行数:49,代码来源:test_rootoftools.py
注:本文中的sympy.polys.rootoftools.RootSum类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论