【问题标题】:Multivariate polynomial coefficients including zeros多元多项式系数,包括零
【发布时间】:2017-03-15 14:29:01
【问题描述】:

我想得到一个多元多项式的系数,包括零系数(在它们的正确位置)。关于两个变量 x,y 的多项式 f,我发现了类似的 answer

现在,我想将此解决方案扩展到 n 个变量 [xo,x1,...xn-1] 的多元多项式 多项式定义如下代码:(注:q=next_prime(10000)

A1 = [(', '.join('x%i'%i for i in [0.. n-1]))]; ### construct a suitable multivariate ring
        V = var(A1[0])                               ### define a str variable
        x=vector(list(V)) ### convert to vector                                                                            
        P1=PolynomialRing(GF(q),V)

我该怎么做?

【问题讨论】:

  • 系数应该按什么顺序列出,是按字典顺序排列的吗?
  • 按多项式内单项式的字典顺序

标签: sage polynomials


【解决方案1】:

首先,给定多项式g,您可以执行P1.monomial_all_divisors(lcm(g.monomials())) 来获取相关单项式的列表。您可能想对该列表进行排序——我不知道默认情况下它的顺序是什么——但你可以这样做:

sage: P1.<x0, x1, x2> = PolynomialRing(GF(7)) # my simple setup
sage: g = 3*x0*x1 - x1^2 + 2*x1*x2

sage: [(m, g.monomial_coefficient(m)) for m in P1.monomial_all_divisors(lcm(g.monomials()))]
[(x0, 0),
 (x1, 0),
 (x0*x1, 3),
 (x1^2, 6),
 (x0*x1^2, 0),
 (x2, 0),
 (x0*x2, 0),
 (x1*x2, 2),
 (x0*x1*x2, 0),
 (x1^2*x2, 0),
 (x0*x1^2*x2, 0)]

【讨论】:

    猜你喜欢
    • 2015-09-06
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多