ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 17 Oct 2017 21:01:03 +0200quotient ringhttps://ask.sagemath.org/question/39021/quotient-ring/I need to compute some things in matrices over a quotient ring. My definition of the quotient ring in question is
R.<A,B,C,D>=QQ[]
I=R.ideal(A,B,C,D)
v = 8
S.<a,b,c,d>=R.quotient_ring(I^(v+1))
In particular, I need to quotient out by large (>8 shown above) powers of the ideal **I**. However, I've noticed that in constructing **S**, Sage much generate all of the monomials in the power of **I** which, when v=10, takes quite awhile. Is there any faster/more efficient way to have Sage internally generate **S**. It actually takes longer to construct **S** than it does to perform my computations.
This might just be how it is given I'm working over a polynomial ring with four indeterminates...Mon, 02 Oct 2017 22:54:37 +0200https://ask.sagemath.org/question/39021/quotient-ring/Answer by dan_fulea for <p>I need to compute some things in matrices over a quotient ring. My definition of the quotient ring in question is </p>
<pre><code>R.<A,B,C,D>=QQ[]
I=R.ideal(A,B,C,D)
v = 8
S.<a,b,c,d>=R.quotient_ring(I^(v+1))
</code></pre>
<p>In particular, I need to quotient out by large (>8 shown above) powers of the ideal <strong>I</strong>. However, I've noticed that in constructing <strong>S</strong>, Sage much generate all of the monomials in the power of <strong>I</strong> which, when v=10, takes quite awhile. Is there any faster/more efficient way to have Sage internally generate <strong>S</strong>. It actually takes longer to construct <strong>S</strong> than it does to perform my computations.</p>
<p>This might just be how it is given I'm working over a polynomial ring with four indeterminates...</p>
https://ask.sagemath.org/question/39021/quotient-ring/?answer=39022#post-id-39022One possibility to construct the ring would be as in the sample code:
sage: S = PowerSeriesRing( base_ring=QQ, names='a,b,c,d', default_prec=9 )
sage: S
Multivariate Power Series Ring in a, b, c, d over Rational Field
sage: a,b,c,d = S.gens()
sage: J = S.O(9)
sage: J
0 + O(a, b, c, d)^9
sage: u = (1+a^3+J)*(1+b^3+J)*(1+c^3+J)*(1+d^3+J)
sage: u
1 + a^3 + b^3 + c^3 + d^3 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^3*c^3 + b^3*d^3 + c^3*d^3 + O(a, b, c, d)^9
sage: 1/u
1 - a^3 - b^3 - c^3 - d^3 + a^6 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^6 + b^3*c^3 + b^3*d^3 + c^6 + c^3*d^3 + d^6 + O(a, b, c, d)^9
The above uses the `PowerSeriesRing` with a declared precision, and the ideal `J` is implemented as an $O$-calculus.
Hope it works for the needed purpose.Tue, 03 Oct 2017 04:02:17 +0200https://ask.sagemath.org/question/39021/quotient-ring/?answer=39022#post-id-39022Comment by malikb for <p>One possibility to construct the ring would be as in the sample code:</p>
<pre><code>sage: S = PowerSeriesRing( base_ring=QQ, names='a,b,c,d', default_prec=9 )
sage: S
Multivariate Power Series Ring in a, b, c, d over Rational Field
sage: a,b,c,d = S.gens()
sage: J = S.O(9)
sage: J
0 + O(a, b, c, d)^9
sage: u = (1+a^3+J)*(1+b^3+J)*(1+c^3+J)*(1+d^3+J)
sage: u
1 + a^3 + b^3 + c^3 + d^3 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^3*c^3 + b^3*d^3 + c^3*d^3 + O(a, b, c, d)^9
sage: 1/u
1 - a^3 - b^3 - c^3 - d^3 + a^6 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^6 + b^3*c^3 + b^3*d^3 + c^6 + c^3*d^3 + d^6 + O(a, b, c, d)^9
</code></pre>
<p>The above uses the <code>PowerSeriesRing</code> with a declared precision, and the ideal <code>J</code> is implemented as an $O$-calculus.
Hope it works for the needed purpose.</p>
https://ask.sagemath.org/question/39021/quotient-ring/?comment=39191#post-id-39191Thanks for this. This is quite promising, though I have one issue. Sage seems loathe to compute something as 0+O(...)^k, and so I'm getting monstrous terms that should simplify to 0 but aren't. Is there any way to have Sage fix the precision to be at most k-power terms so that 0 entries can be written? I can't seem to find any documentation about this.Mon, 16 Oct 2017 19:13:46 +0200https://ask.sagemath.org/question/39021/quotient-ring/?comment=39191#post-id-39191Comment by dan_fulea for <p>One possibility to construct the ring would be as in the sample code:</p>
<pre><code>sage: S = PowerSeriesRing( base_ring=QQ, names='a,b,c,d', default_prec=9 )
sage: S
Multivariate Power Series Ring in a, b, c, d over Rational Field
sage: a,b,c,d = S.gens()
sage: J = S.O(9)
sage: J
0 + O(a, b, c, d)^9
sage: u = (1+a^3+J)*(1+b^3+J)*(1+c^3+J)*(1+d^3+J)
sage: u
1 + a^3 + b^3 + c^3 + d^3 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^3*c^3 + b^3*d^3 + c^3*d^3 + O(a, b, c, d)^9
sage: 1/u
1 - a^3 - b^3 - c^3 - d^3 + a^6 + a^3*b^3 + a^3*c^3 + a^3*d^3 + b^6 + b^3*c^3 + b^3*d^3 + c^6 + c^3*d^3 + d^6 + O(a, b, c, d)^9
</code></pre>
<p>The above uses the <code>PowerSeriesRing</code> with a declared precision, and the ideal <code>J</code> is implemented as an $O$-calculus.
Hope it works for the needed purpose.</p>
https://ask.sagemath.org/question/39021/quotient-ring/?comment=39199#post-id-39199The `default_prec` should be given in the initialization of the power series ring.
Also, it is important to use as often as possible (in all factors) the apparently insignificant `+J`. For example, in the example posted above, basicly
S = PowerSeriesRing( base_ring=QQ,
names='a,b',
default_prec=9 )
a,b = S.gens()
J = S.O(9)
u = (1+a^3+J)^10 * (1+b^3+J)^10
bad_u = (1+a^3 )^10 * (1+b^3 )^10
there is a **big** difference between `u` and `bad_u`.
sage: u
1 + 10*a^3 + 10*b^3 + 45*a^6 + 100*a^3*b^3 + 45*b^6 + O(a, b)^9
sage: bad_u
1 + 10*a^3 + 10*b^3 + 45*a^6 + 100*a^3*b^3 + 45*b^6 + 120*a^9 + 450*a^6*b^3 + 450*a^3*b^6 + 120*b^9 + 210*a^12 + 1200*a^9*b^3 + 2025*a^6*b^6 + 1200*a^3*b^9 + ...
and this is not all mess...Tue, 17 Oct 2017 21:01:03 +0200https://ask.sagemath.org/question/39021/quotient-ring/?comment=39199#post-id-39199