Exemplo n.º 1
0
 def g():
     eeuc(0, 3)
Exemplo n.º 2
0
 def test_polynomial_linear_combination(self):
     """Polynomial GCD as linear combination"""
     R = Polynomials(FiniteField(7))
     p, q = R(1, 3, 1, 2, 4), R(1, 0, 1, 1)
     x, y, d = eeuc(p, q)
     self.assert_(x * p + y * q == d)
Exemplo n.º 3
0
 def f():
     eeuc(3, 0)
Exemplo n.º 4
0
 def test_integer_linear_combination(self):
     """Integer GCD as linear combination"""
     x, y, d = eeuc(17, 25)
     self.assert_(x * 17 + y * 25 == d)
Exemplo n.º 5
0
 def test_polynomial_gcd(self):
     """Polynomial GCD"""
     # gcd( (x+1)^2, (x+1)(x-1) ) == (x+1)
     R = Polynomials(FiniteField(7))
     gcd = eeuc(R(1, 2, 1), R(-1, 0, 1))[2]  # Make monic
     self.assert_(gcd // gcd.leading_coefficient() == R(1, 1))
Exemplo n.º 6
0
 def g():
     eeuc( 0, 3 )
Exemplo n.º 7
0
 def test_integer_gcd(self):
     """Integer GCD"""
     self.assert_(eeuc(17, 25)[2] == 1)
     self.assert_(eeuc(24, 27)[2] == 3)
Exemplo n.º 8
0
 def f():
     eeuc( 3, 0 )
Exemplo n.º 9
0
 def test_polynomial_linear_combination(self):
     """Polynomial GCD as linear combination"""
     R = Polynomials( FiniteField(7) )
     p, q = R(1, 3, 1, 2, 4), R(1, 0, 1, 1)
     x, y, d = eeuc( p, q )
     self.assert_( x*p + y*q == d )
Exemplo n.º 10
0
 def test_polynomial_gcd(self):
     """Polynomial GCD"""
     # gcd( (x+1)^2, (x+1)(x-1) ) == (x+1)
     R = Polynomials( FiniteField(7) )
     gcd = eeuc( R(1, 2, 1), R(-1, 0, 1) )[2]   # Make monic
     self.assert_( gcd // gcd.leading_coefficient() == R(1, 1) )
Exemplo n.º 11
0
 def test_integer_linear_combination(self):
     """Integer GCD as linear combination"""
     x, y, d = eeuc( 17, 25 )
     self.assert_( x*17 + y*25 == d )
Exemplo n.º 12
0
 def test_integer_gcd(self):
     """Integer GCD"""
     self.assert_( eeuc( 17, 25 )[2] == 1 )
     self.assert_( eeuc( 24, 27 )[2] == 3 )