本文整理汇总了Python中sympy.separate函数的典型用法代码示例。如果您正苦于以下问题:Python separate函数的具体用法?Python separate怎么用?Python separate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了separate函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_roots_binomial
def test_roots_binomial():
assert roots_binomial(Poly(5*x, x)) == [0]
assert roots_binomial(Poly(5*x**4, x)) == [0, 0, 0, 0]
assert roots_binomial(Poly(5*x+2, x)) == [-Rational(2, 5)]
A = 10**Rational(3, 4)/10
assert roots_binomial(Poly(5*x**4+2, x)) == \
[A+I*A, -A+I*A, -A-I*A, A-I*A]
a1 = Symbol('a1', nonnegative=True)
b1 = Symbol('b1', nonnegative=True)
r0 = roots_quadratic(Poly(a1*x**2 + b1, x))
r1 = roots_binomial(Poly(a1*x**2 + b1, x))
assert separate(r0[0]) == separate(r1[0])
assert separate(r0[1]) == separate(r1[1])
示例2: test_separate
def test_separate():
x, y, z = map(Symbol, 'xyz')
assert separate((x*y*z)**4) == x**4*y**4*z**4
assert separate((x*y*z)**x) == x**x*y**x*z**x
assert separate((x*(y*z)**2)**3) == x**3*y**6*z**6
assert separate((sin((x*y)**2)*y)**z) == sin((x*y)**2)**z*y**z
assert separate((sin((x*y)**2)*y)**z, deep=True) == sin(x**2*y**2)**z*y**z
assert separate(exp(x)**2) == exp(2*x)
assert separate((exp(x)*exp(y))**2) == exp(2*x)*exp(2*y)
assert separate((exp((x*y)**z)*exp(y))**2) == exp(2*(x*y)**z)*exp(2*y)
assert separate((exp((x*y)**z)*exp(y))**2, deep=True) == exp(2*x**z*y**z)*exp(2*y)
示例3: test_action_verbs
def test_action_verbs():
assert nsimplify((1/(exp(3*pi*x/5)+1))) == (1/(exp(3*pi*x/5)+1)).nsimplify()
assert ratsimp(1/x + 1/y) == (1/x + 1/y).ratsimp()
assert trigsimp(log(x), deep=True) == (log(x)).trigsimp(deep = True)
assert radsimp(1/(2+sqrt(2))) == (1/(2+sqrt(2))).radsimp()
assert powsimp(x**y*x**z*y**z, combine='all') == (x**y*x**z*y**z).powsimp(combine='all')
assert simplify(x**y*x**z*y**z) == (x**y*x**z*y**z).simplify()
assert together(1/x + 1/y) == (1/x + 1/y).together()
assert separate((x*(y*z)**3)**2) == ((x*(y*z)**3)**2).separate()
assert collect(a*x**2 + b*x**2 + a*x - b*x + c, x) == (a*x**2 + b*x**2 + a*x - b*x + c).collect(x)
assert apart(y/(y+2)/(y+1), y) == (y/(y+2)/(y+1)).apart(y)
assert combsimp(y/(x+2)/(x+1)) == (y/(x+2)/(x+1)).combsimp()
assert factor(x**2+5*x+6) == (x**2+5*x+6).factor()
assert refine(sqrt(x**2)) == sqrt(x**2).refine()
assert cancel((x**2+5*x+6)/(x+2)) == ((x**2+5*x+6)/(x+2)).cancel()
示例4: test_separate
def test_separate():
x, y, z = symbols('x,y,z')
assert separate((x*y*z)**4) == x**4*y**4*z**4
assert separate((x*y*z)**x).is_Pow
assert separate((x*y*z)**x, force=True) == x**x*y**x*z**x
assert separate((x*(y*z)**2)**3) == x**3*y**6*z**6
assert separate((sin((x*y)**2)*y)**z).is_Pow
assert separate((sin((x*y)**2)*y)**z, force=True) == sin((x*y)**2)**z*y**z
assert separate((sin((x*y)**2)*y)**z, deep=True) == (sin(x**2*y**2)*y)**z
assert separate(exp(x)**2) == exp(2*x)
assert separate((exp(x)*exp(y))**2) == exp(2*x)*exp(2*y)
assert separate((exp((x*y)**z)*exp(y))**2) == exp(2*(x*y)**z)*exp(2*y)
assert separate((exp((x*y)**z)*exp(y))**2, deep=True, force=True) == exp(2*x**z*y**z)*exp(2*y)
assert separate((exp(x)*exp(y))**z).is_Pow
assert separate((exp(x)*exp(y))**z, force=True) == exp(x)**z*exp(y)**z
示例5: test_separate_X1
def test_separate_X1():
x, y, z = map(Symbol, 'xyz')
assert separate((exp(x)*exp(y))**z) == exp(x*z)*exp(y*z)
示例6: test_separate_X1
def test_separate_X1():
assert separate((exp(x)*exp(y))**z) == exp(x*z)*exp(y*z)