polynoomring

3821 days ago by J.Demeyer

CC 
       
Complex Field with 53 bits of precision
Complex Field with 53 bits of precision
QQ 
       
Rational Field
Rational Field
IntegerModRing(5) 
       
Ring of integers modulo 5
Ring of integers modulo 5
R.<x> = IntegerModRing(5)[] 
       
(x+1)^5 
       
x^5 + 1
x^5 + 1
parent(x) 
       
Univariate Polynomial Ring in x over Ring of integers modulo 5
Univariate Polynomial Ring in x over Ring of integers modulo 5
A = IntegerModRing(5) 
       
a = A(1/5) a 
       
Traceback (click to the left of this block for traceback)
...
ZeroDivisionError: Inverse does not exist.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_10.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSA9IEEoMS81KQph"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/var/sage/tmpcq3LSS/___code___.py", line 3, in <module>
    a = A(_sage_const_1 /_sage_const_5 )
  File "parent.pyx", line 1067, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8048)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3345)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3248)
  File "/opt/sage/sage-5.1-ugent/local/lib/python2.7/site-packages/sage/rings/finite_rings/integer_mod_ring.py", line 925, in _element_constructor_
    return integer_mod.IntegerMod(self, x)
  File "integer_mod.pyx", line 173, in sage.rings.finite_rings.integer_mod.IntegerMod (sage/rings/finite_rings/integer_mod.c:3198)
  File "integer_mod.pyx", line 1994, in sage.rings.finite_rings.integer_mod.IntegerMod_int.__init__ (sage/rings/finite_rings/integer_mod.c:17789)
  File "rational.pyx", line 2472, in sage.rings.rational.Rational.__mod__ (sage/rings/rational.c:18798)
  File "integer.pyx", line 5482, in sage.rings.integer.Integer.inverse_mod (sage/rings/integer.c:30865)
ZeroDivisionError: Inverse does not exist.
parent(a) 
       
Traceback (click to the left of this block for traceback)
...
NameError: name 'a' is not defined
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_11.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cGFyZW50KGEp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/var/sage/tmpmhbM2F/___code___.py", line 2, in <module>
    exec compile(u'parent(a)
  File "", line 1, in <module>
    
NameError: name 'a' is not defined
a * 5 
       
Traceback (click to the left of this block for traceback)
...
NameError: name 'a' is not defined
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_12.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YSAqIDU="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/var/sage/tmpjl2sRf/___code___.py", line 3, in <module>
    exec compile(u'a * _sage_const_5 
  File "", line 1, in <module>
    
NameError: name 'a' is not defined
 
       
R.<x> = QQ[] E = R.quotient(R.ideal(x^2+1)) E 
       
Univariate Quotient Polynomial Ring in xbar over Rational Field with
modulus x^2 + 1
Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 + 1
E.is_field() 
       
True
True
H.<xbar> = R.quotient(R.ideal(x^2-1)) H.is_field() 
       
False
False
p = 3 h = 3 R.<x> = IntegerModRing(p)[] 
       
a = R.random_element(h) while not a.is_irreducible() or a.degree() < h: a = R.random_element(h) a 
       
2*x^3 + x^2 + 2*x + 2
2*x^3 + x^2 + 2*x + 2
F.<b> = R.quotient(a) 
       
F.is_field() 
       
True
True
1/b 
       
2*b^2 + b + 2
2*b^2 + b + 2
def eucl(a,b): while b != 0: q, r = a.quo_rem(b) a, b = b, r # i = i + 1 return a 
       
eucl(12345,999) 
       
3
3
R.<x> = QQ[] 
       
eucl(2*x^12 - 2, 2*x^16 - 2) 
       
2*x^4 - 2
2*x^4 - 2