Substitution in infinite polynomial rings

34 views
Skip to first unread message

BJ

unread,
Apr 16, 2014, 7:16:30 PM4/16/14
to sage-s...@googlegroups.com
I have the following code, which produces a list of polynomials in the infinite number of variables e_0, e_1, ...

M.<e> = InfinitePolynomialRing(QQ, implementation="sparse")
S.<z> = LaurentSeriesRing(M)
Qxy.<X,Y> = PolynomialRing(QQ)
a=var('a')
b=var('b')
k=var('k')
L=[]
n=6
x = 1/z^2 + sum([(-1)^(a+2)*(2*a+1)/factorial(2*a+2)*bernoulli(2*a+2)*e[2*a+2]*z^(2*a) for a in [1..n]])
y = x.derivative(z)
v = y^2 - 4*x^3 - 20*3/factorial(4)*bernoulli(4)*e[4]*x + 28*5/factorial(6)*bernoulli(6)*e[6]
coeff = v.coefficients()
for k in [0..n]:
    a = vector(coeff[k].coefficients())
    L.append((coeff[k]*a.denominator()).polynomial())
print L

The output looks something like this:

[-e_8 + e_4^2, -e_10 + e_6*e_4, -1382*e_12 + 2205*e_8*e_4 + 500*e_6^2 -
1323*e_4^3, -10*e_14 + 21*e_10*e_4 + 22*e_8*e_6 - 33*e_6*e_4^2,
45606*e_12*e_4 + 65000*e_10*e_6 + 42042*e_8^2 - 63063*e_8*e_4^2 -
71500*e_6^2*e_4, 126126*e_14*e_4 + 212828*e_12*e_6 + 309582*e_10*e_8 -
154791*e_10*e_4^2 - 378378*e_8*e_6*e_4 - 71500*e_6^3, 858000*e_14*e_6 +
1337776*e_12*e_8 - 501666*e_12*e_4^2 + 760500*e_10^2 -
1287000*e_10*e_6*e_4 - 693693*e_8^2*e_4 - 786500*e_8*e_6^2]

These list elements should be interpreted as relations between the variables e_i (for even i), so that, for instance, the first one should be interpreted as e_8 = e_4^2.

Moreover, I know that these relations should allow me to inductively express each e_k in terms of e_4 and e_6. For instance, the second relation shows that e_10 = e_4e_6. The third relation -1382*e_12 + 2205*e_8*e_4 + 500*e_6^2 -1323*e_4^3 = 0 allows me (using a pen and paper...) to express e_12 only in terms of e_4 and e_6, by using e_8 = e_4^2.

What I would like is to be able, for each k in the appropriate range, to obtain a polynomial f_k(u,v) with rational coefficients, such that f_k(e_4, e_6) = e_k. For instance, the first relation should give me f_8(u,v) = u^2. However, I've been having a lot of trouble figuring out how to do substitutions in these polynomial rings in order to get what I want.

I would really appreciate it if someone could point me in the right direction. Thank you!

Nils Bruin

unread,
Apr 17, 2014, 12:39:09 PM4/17/14
to sage-s...@googlegroups.com


On Wednesday, April 16, 2014 4:16:30 PM UTC-7, BJ wrote:
I have the following code, which produces a list of polynomials in the infinite number of variables e_0, e_1, ...

M.<e> = InfinitePolynomialRing(QQ, implementation="sparse") 
However, I've been having a lot of trouble figuring out how to do substitutions in these polynomial rings in order to get what I want.


I think the following should be the recommended way of doing this, but currently it doesn't  work:

sage: f = e[1]^2+e[2]^3
sage: f.subs({e[1]: 2})   #this doesn't work
4+e_2^3

the following does work:

sage: f(e_1=2)
4+e_2^3

but it's flawed:

sage: f(e_4=2)
KeyError: 'e_4'

The problem seems to be that the standard subs routines expect the parent to have a finite, predetermined sequence of generators. That's of course not the case for your rings. I think InfinitePolynomialRing has to override more of the methods involved.

Nils Bruin

unread,
Apr 17, 2014, 12:41:18 PM4/17/14
to sage-s...@googlegroups.com
On Thursday, April 17, 2014 9:39:09 AM UTC-7, Nils Bruin wrote:

but it's flawed:

sage: f(e_4=2)
KeyError: 'e_4'

And also flawed in a different way:

 sage: f(e_2=e[4])
TypeError: unsupported operand parent(s) for '+': 'Multivariate Polynomial Ring in e_4, e_2, e_1 over Rational Field' and 'Multivariate Polynomial Ring in e_4, e_0 over Rational Field

Simon King

unread,
Apr 22, 2014, 4:00:21 AM4/22/14
to sage-s...@googlegroups.com
Hi Bruno,

I am sorry that I (as author of the InfinitePolynomialRing stuff) did
not answer before.

On 2014-04-16, BJ <bruno...@gmail.com> wrote:
> The output looks something like this:
>
> [-e_8 + e_4^2, -e_10 + e_6*e_4, -1382*e_12 + 2205*e_8*e_4 + 500*e_6^2 -
>> 1323*e_4^3, -10*e_14 + 21*e_10*e_4 + 22*e_8*e_6 - 33*e_6*e_4^2,
>> 45606*e_12*e_4 + 65000*e_10*e_6 + 42042*e_8^2 - 63063*e_8*e_4^2 -
>> 71500*e_6^2*e_4, 126126*e_14*e_4 + 212828*e_12*e_6 + 309582*e_10*e_8 -
>> 154791*e_10*e_4^2 - 378378*e_8*e_6*e_4 - 71500*e_6^3, 858000*e_14*e_6 +
>> 1337776*e_12*e_8 - 501666*e_12*e_4^2 + 760500*e_10^2 -
>> 1287000*e_10*e_6*e_4 - 693693*e_8^2*e_4 - 786500*e_8*e_6^2]
>
>
> These list elements should be interpreted as relations between the
> variables e_i (for even i), so that, for instance, the first one should be
> interpreted as e_8 = e_4^2.
>
> Moreover, I know that these relations should allow me to inductively
> express each e_k in terms of e_4 and e_6.

The original purpose of InfinitePolynomialRing is to implement the algorithm of
Aschenbrenner and Hillar for the computation of "symmetric Gröbner bases". This
means: You would be in a situation where any permutation of indices applied
to a relation between the e[i] results in another relation between the
e[i]. In your example, you could easily deduce that all coefficients
would be trivial if you would allow to freely permute indices:

sage: SI = M.ideal(L)
sage: SG = SI.groebner_basis()
sage: SG
[e_1]

Do you have any permutation action at all on your coefficients? Say, if
you have a relation then shifting all coefficients by 1 will result in
another relation? If I recall correctly, it is not implemented yet, but
it should be possible (without being able to guarantee termination of
the algorithm, though) to consider a subgroup of the full permutation
group.

> For instance, the second relation
> shows that e_10 = e_4e_6. The third relation -1382*e_12 + 2205*e_8*e_4 +
> 500*e_6^2 -1323*e_4^3 = 0 allows me (using a pen and paper...) to express
> e_12 only in terms of e_4 and e_6, by using e_8 = e_4^2.
>
> What I would like is to be able, for each k in the appropriate range, to
> obtain a polynomial f_k(u,v) with rational coefficients, such that f_k(e_4,
> e_6) = e_k.

Well, if you have any *finite* list of relations and no index
permutations on it, then you could simply use classical (non-symmetric)
Gröbner bases. In fact, by your construction, all element of your list L
are "classical" polynomials. Hence, it should be easy to get a
polynomial ring with the variables involved in this list, and hopefully
such that e_j>e_i for j>i, because then the Gröbner basis will tell you
how to express e_k in terms of e_4,e_6 for k>6.

Let's try:

sage: I = ideal(L)
sage: I
Ideal (-e_8 + e_4^2, -e_10 + e_6*e_4, -1382*e_12 + 2205*e_8*e_4 +
500*e_6^2 - 1323*e_4^3, -10*e_14 + 21*e_10*e_4 + 22*e_8*e_6 -
33*e_6*e_4^2, 45606*e_12*e_4 + 65000*e_10*e_6 + 42042*e_8^2 -
63063*e_8*e_4^2 - 71500*e_6^2*e_4, 126126*e_14*e_4 + 212828*e_12*e_6 +
309582*e_10*e_8 - 154791*e_10*e_4^2 - 378378*e_8*e_6*e_4 -
71500*e_6^3, 858000*e_14*e_6 + 1337776*e_12*e_8 - 501666*e_12*e_4^2 +
760500*e_10^2 - 1287000*e_10*e_6*e_4 - 693693*e_8^2*e_4 -
786500*e_8*e_6^2) of Multivariate Polynomial Ring in e_14, e_12, e_10,
e_8, e_6, e_4, e_0 over Rational Field
sage: G
[e_14 - e_6*e_4^2, e_12 - 250/691*e_6^2 - 441/691*e_4^3, e_10 -
e_6*e_4, e_8 - e_4^2, e_6^3 + 38367/5500*e_6*e_4^3, e_6^2*e_4 +
1617/2000*e_4^4, e_6*e_4^4, e_4^5]
sage: P = G.ring()
sage: P
Multivariate Polynomial Ring in e_14, e_12, e_10, e_8, e_6, e_4, e_0
over Rational Field
sage: P('e_10').reduce(G)
e_6*e_4
sage: P('e_12').reduce(G)
250/691*e_6^2 + 441/691*e_4^3
sage: P('e_14').reduce(G)
e_6*e_4^2

Does this solve your problem?

I am very sorry for the late answer.

Best regards,
Simon







Reply all
Reply to author
Forward
0 new messages