Thank you!  The patch worked well.

Unfortunately, the computation is very slow with option "sparse".  It
takes forever to complete
sage: p = 1073741477
sage: A.<T>  = PolynomialRing(Integers(p),sparse=True)
sage: f = T^5 + 13775595*T^4 + 788683423*T^3 + 305120033*T^2 +
585880735*T + 686097596
sage: B = A.quo(f)
sage: B(T^11111+1)

while without "sparse" it works:
sage: p = 1073741477
sage: A.<T>  = PolynomialRing(Integers(p))
sage: f = T^5 + 13775595*T^4 + 788683423*T^3 + 305120033*T^2 +
585880735*T + 686097596
sage: B = A.quo(f)
sage: B(T^11111+1)
324656387*Tbar^4 + 613493223*Tbar^3 + 992200277*Tbar^2 +
1034008351*Tbar + 876628216

Also a simple evaluation of hight degree polynomial produces an error
message:
sage: p = 1073741477
sage: A.<T>  = PolynomialRing(Integers(p),sparse=True)
sage: Pz.<z> = PolynomialRing(A,sparse=True)
sage: g = z^p + T*z
sage: print g(1)
Traceback (most recent call last):
...
MemoryError

but I guess my naive and straightforward approach to this type of
computations with large numbers does not work and I have to look for
some tricks ;)
K.


On May 22, 11:52 pm, "Craig Citro" <[EMAIL PROTECTED]> wrote:
> Yep, this was a bug. Fix is up here:
>
> http://trac.sagemath.org/sage_trac/ticket/3272
>
> Give it a try, and let me know if you run into any more trouble.
>
> -cc
>
> On Thu, May 22, 2008 at 11:13 AM, Kirill Vankov <[EMAIL PROTECTED]> wrote:
>
> > Is there any way to define a polynomial ring over a sparse quotient
> > ring?
>
> > This works:
> > sage: p = 5
> > sage: A.<T> = PolynomialRing(Integers(p))
> > sage: f = T^2+1
> > sage: B = A.quo(f)
> > sage: print B
> > sage: C.<s> = PolynomialRing(B)
> > sage: print C
> > Univariate Quotient Polynomial Ring in Tbar over Ring of integers
> > modulo 5 with modulus T^2 + 1
> > Univariate Polynomial Ring in s over Univariate Quotient Polynomial
> > Ring in Tbar over Ring of integers modulo 5 with modulus T^2 + 1
>
> > But this does not work:
> > sage: p = 5
> > sage: A.<T> = PolynomialRing(Integers(p),sparse=True)
> > sage: f = T^2+1
> > sage: B = A.quo(f)
> > sage: print B
> > sage: C.<s> = PolynomialRing(B)
> > Univariate Quotient Polynomial Ring in Tbar over Ring of integers
> > modulo 5 with modulus T^2 + 1
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "/home/kvankov/.sage/sage_notebook/worksheets/admin/16/code/
> > 189.py", line 11, in <module>
> >    exec compile(ur'C = PolynomialRing(B,names=(\u0027s\u0027,)); (s,)
> > = C._first_ngens(Integer(1))' + '\n', '', 'single')
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sympy/plotting/", line 1, in <module>
>
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/polynomial/
> > polynomial_ring_constructor.py", line 256, in PolynomialRing
> >    R = _single_variate(base_ring, name, sparse)
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/polynomial/
> > polynomial_ring_constructor.py", line 329, in _single_variate
> >    elif base_ring.is_field():
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/polynomial/
> > polynomial_quotient_ring.py", line 412, in is_field
> >    return self.base_ring().is_field() and
> > self.modulus().is_irreducible()
> >  File "polynomial_element.pyx", line 3762, in
> > sage.rings.polynomial.polynomial_element.Polynomial.is_irreducible
> >  File "polynomial_element.pyx", line 2109, in
> > sage.rings.polynomial.polynomial_element.Polynomial.factor
> >  File "polynomial_element.pyx", line 2118, in
> > sage.rings.polynomial.polynomial_element.Polynomial._factor_pari_helper
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/polynomial/polynomial_ring.py",
> > line 243, in __call__
> >    return C(self, x, check, is_gen, construct=construct)
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/polynomial/
> > polynomial_element_generic.py", line 95, in __init__
> >    self.__coeffs[i] = R(z)
> >  File "/usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
> > python2.5/site-packages/sage/rings/integer_mod_ring.py", line 579, in
> > __call__
> >    return integer_mod.IntegerMod(self, x)
> >  File "integer_mod.pyx", line 129, in
> > sage.rings.integer_mod.IntegerMod
> >  File "integer_mod.pyx", line 1380, in
> > sage.rings.integer_mod.IntegerMod_int.__init__
> >  File "integer_ring.pyx", line 274, in
> > sage.rings.integer_ring.IntegerRing_class.__call__
> >  File "integer.pyx", line 377, in sage.rings.integer.Integer.__init__
> >  File "gen.pyx", line 750, in sage.libs.pari.gen.gen.__hex__
> > TypeError: gen must be of PARI type t_INT
>
> > K.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to