我得到了这样的Ryacas表达式,我想提取x ^ 4,11的系数。谢谢,我该如何编写代码。
答案 0 :(得分:0)
希望这会有所帮助:
x <- Sym("x")
P <- (x+1)*(x+2)*(x+3)
Expand(P)
# expression(x^3 + 6 * x^2 + 11 * x + 6)
# coefficient of x^2:
yacas("Coef((x+1)*(x+2)*(x+3), x, 2)")
# expression(6)
# or:
yacas(paste0("Coef(", P, ",x , 2)"))
# expression(6)