Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
z3简化为多项式形式_Z3_Polynomial Math_Z3py - Fatal编程技术网

z3简化为多项式形式

z3简化为多项式形式,z3,polynomial-math,z3py,Z3,Polynomial Math,Z3py,如何使用z3以多项式形式打印(x)的复函数?simplify功能可打印以下内容: -1/120*(-5 + x)*(-4 + x)*(-3 + x)*(-2 + x)*(-1 + x) + 1/12*x*(-5 + x)*(-4 + x)*(-3 + x)*(-2 + x) + 使用Z3Py的一种可能的解决方案 x = Real('x') y = (-1/120)*(-5+x)*(-4+x)*(-3+x)*(-2+x)*(-1+x) z = (1/12)*(-5+x)*(-4+x)*(-3+x

如何使用z3以多项式形式打印(x)的复函数?
simplify
功能可打印以下内容:

-1/120*(-5 + x)*(-4 + x)*(-3 + x)*(-2 + x)*(-1 + x) +
1/12*x*(-5 + x)*(-4 + x)*(-3 + x)*(-2 + x) +

使用Z3Py的一种可能的解决方案

x = Real('x')
y = (-1/120)*(-5+x)*(-4+x)*(-3+x)*(-2+x)*(-1+x)
z = (1/12)*(-5+x)*(-4+x)*(-3+x)*(-2+x)
w = y + z
print simplify(simplify(w, som=True), mul_to_power=True)
相应的输出是

120 + -274*x + 225*x**2 + -85*x**3 + 15*x**4 + -1*x**5

你的理想输出是什么?(x-5)(x-4)(x-3)(x-2)(9x+1)/120?这是多项式形式的和(a_i*x^i)