Hi,

Just realized that   gcd( [( a0 + 1 ) * x , ( a0 + 1 ) * x * y] )=x is
correct.

This makes me wonder whether to exception of the second gcd
(after adjoining a1) is a bug, or whether my construction of the numberfield
is
incorrect.

Maybe i should have asked this question at sage-support

Kind regards,

Niels

On Tue, Nov 16, 2010 at 12:28 PM, Niels <niels.lub...@gmail.com> wrote:

> Hi,
>
> I would like to compute the gcd of two bi-variate polynomials over a number
> field:
>
> sage:     R = PolynomialRing( QQ, var( 't' ), order = 'lex' )
> sage:     t = R.gens()[0]
> sage:     T = NumberFieldTower( [t ** 2 - t + 1], 'a0' )
> sage:     a0 = T.gens()[0]
> sage:     R = R.change_ring( T )
> sage:
> sage:     P = PolynomialRing( T, var( 'x,y' ), order = 'lex' )
> sage:     x, y = P.gens()
> sage:
> sage:     gcd( [( a0 + 1 ) * x , ( a0 + 1 ) * x * y] )
> x
>
> # This should be ( a0 + 1 ) * x.
>
> sage:
> sage:     t = R.gens()[0]
> sage:     T = NumberFieldTower( [ t ** 2 - a0], 'a1' )
> sage:     a1 = T.gens()[0]
> sage:
> sage:     P = PolynomialRing( T, var( 'x,y' ), order = 'lex' )
> sage:     x, y = P.gens()
> sage:
>
> # Computing the gcd in QQ(a0,a1)[x,y] gives problems.
> # (btw qou_rem and divides also don't work over this ring)
>
> sage:     gcd( [( a0 + 1 ) * x , ( a0 + 1 ) * x * y] )
>
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
>
> /home/niels/<ipython console> in <module>()
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/rings/arith.pyc
> in gcd(a, b, **kwargs)
>    1434     if U is ZZ or U is int or U is long:#
> ZZ.has_coerce_map_from(U):
>    1435         return sage.rings.integer.GCD_list(a)
> -> 1436     return __GCD_sequence(seq, **kwargs)
>    1437
>    1438 GCD = gcd
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/rings/arith.pyc
> in __GCD_sequence(v, **kwargs)
>    1476     one = v.universe()(1)
>    1477     for vi in v:
> -> 1478         g = vi.gcd(g, **kwargs)
>    1479         if g == one:
>    1480             return g
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/structure/element.so
> in sage.structure.element.Element.__getattr__
> (sage/structure/element.c:2666)()
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
> in sage.structure.parent.getattr_from_other_class
> (sage/structure/parent.c:2840)()
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
> in sage.structure.parent.raise_attribute_error
> (sage/structure/parent.c:2638)()
>
> AttributeError: 'MPolynomial_polydict' object has no attribute 'gcd'
> sage:
> ---------------------------------------------------------------------------
>
> # giving 2 elements to gcd instead of a list, gives rise to different
> exception
>
>
> sage: gcd( ( a0 + 1 ) * x , ( a0 + 1 ) * x * y )
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
>
> /home/niels/<ipython console> in <module>()
>
> /home/niels/Desktop/n/app/sage/local/lib/python2.6/site-packages/sage/rings/arith.pyc
> in gcd(a, b, **kwargs)
>    1427                 return ZZ(a).gcd(ZZ(b))
>    1428             except TypeError:
> -> 1429                 raise TypeError, "unable to find gcd of %s and
> %s"%(a,b)
>    1430
>    1431     from sage.structure.sequence import Sequence
>
> TypeError: unable to find gcd of (a0 + 1)*x and (a0 + 1)*x*y
> sage:
> ---------------------------------------------------------------------------
>
> Kind regards,
>
> Niels
>
>
>
>
>

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to