[英]Sympy Rationals - express (x + 3 )**6/ 6
I'm not able to do this and I'm not sure why? 我无法做到这一点,我不确定为什么吗? When I enter: 当我输入:
x = symbols('x')
exp = Rational((x+3)**6, 6)
I'm given a Type_Error. 我得到了Type_Error。
This stems from trying to integrate (x + 3)**5
and expecting the result of (x+3)**6 / 6
这源于试图积分(x + 3)**5
并期望结果(x+3)**6 / 6
The type Rational
in Sympy represents a rational number, not a polynomial over the rational numbers; Sympy中的Rational
类型表示有理数,而不是有理数的多项式; see the documentation . 请参阅文档 。 Simply use division instead: 只需使用除法即可:
p = (x + 3) ** 6 / 6
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.