Are you sure you mean to give NumberField() two polynomials, one of which (x) defines the trivial extension? You are only giving one name so I rpresume what you mean (to define a quadratic field) is
sage: NumberField([x^2-3],'a') Number Field in a with defining polynomial x^2 - 3 sage: F=NumberField([x^2-3],'a') sage: F.gens() (a,) On 16/02/2008, Jason Grout <[EMAIL PROTECTED]> wrote: > > Is the following output for b.gens() correct? > > sage: NumberField([x,x^2-3],'a') > Number Field in a0 with defining polynomial x over its base field > sage: b=NumberField([x,x^2-3],'a') > sage: b.gens() > (0, 0) > > To contrast: > > sage: c=NumberField([x^2-3, x^2-2],'a') > sage: c.gens() > (a0, a1) > > > Also, this blows up: > > sage: c=NumberField([x^2-3, x],'a') The problem here is that x is triggering a an error in the irreducibility test, which is a little bizarre since of course x is irreducible. So the real issue is: why is x allowed to determine an absolute number field (base Q) but not a relative one? My guess is that this is a side-effect of the differing code being used to test irreducibility in the two cases, Personally, I think that trivial extensions should be allowed and treated just as non-trivial ones. I have recently had to define extensions of the ring ZZ, and find this awkward: sage: R=ZZ.extension(x^2+5,'a') sage: R.gens() [1, a] sage: S=ZZ.extension(x+5,'b') sage: S.gens() [1] In the latter case I need S to remember the polynomial used to generaite it and would expect its gens() to include (in this case) -5. On the same topic, R and S above have no defining_polynomial() method. I'll try to fix that if it looks easy. John > --------------------------------------------------------------------------- > <class 'sage.libs.pari.gen.PariError'> Traceback (most recent call last) > > /home/grout/sage/<ipython console> in <module>() > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in NumberField(polynomial, name, check, names, cache) > 243 > 244 if isinstance(polynomial, (list, tuple)): > --> 245 return NumberFieldTower(polynomial, name) > 246 > 247 name = sage.structure.parent_gens.normalize_names(1, name) > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in NumberFieldTower(v, names, check) > 411 # return z > 412 #else: > --> 413 return w.extension(f, name, check=check) > 414 > 415 > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in extension(self, poly, name, names, check) > 1813 if name is None: > 1814 raise TypeError, "the variable name must be specified." > -> 1815 return NumberField_relative(self, poly, str(name), > check=check) > 1816 > 1817 def factor_integer(self, n): > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in __init__(self, base, polynomial, name, latex_name, names, check) > 3110 > 3111 if check: > -> 3112 if not polynomial_y.is_irreducible(): > 3113 raise ValueError, "defining polynomial (%s) > must be irreducible"%polynomial > 3114 > > /home/grout/sage/polynomial_element.pyx in > sage.rings.polynomial.polynomial_element.Polynomial.is_irreducible() > > /home/grout/sage/polynomial_element.pyx in > sage.rings.polynomial.polynomial_element.Polynomial.factor() > > /home/grout/sage/gen.pyx in sage.libs.pari.gen._pari_trap() > > <class 'sage.libs.pari.gen.PariError'>: (8) > sage: c=NumberField([x^2-3, x-1],'a') > --------------------------------------------------------------------------- > <class 'sage.libs.pari.gen.PariError'> Traceback (most recent call last) > > /home/grout/sage/<ipython console> in <module>() > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in NumberField(polynomial, name, check, names, cache) > 243 > 244 if isinstance(polynomial, (list, tuple)): > --> 245 return NumberFieldTower(polynomial, name) > 246 > 247 name = sage.structure.parent_gens.normalize_names(1, name) > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in NumberFieldTower(v, names, check) > 411 # return z > 412 #else: > --> 413 return w.extension(f, name, check=check) > 414 > 415 > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in extension(self, poly, name, names, check) > 1813 if name is None: > 1814 raise TypeError, "the variable name must be specified." > -> 1815 return NumberField_relative(self, poly, str(name), > check=check) > 1816 > 1817 def factor_integer(self, n): > > /home/grout/sage/local/lib/python2.5/site-packages/sage/rings/number_field/number_field.py > in __init__(self, base, polynomial, name, latex_name, names, check) > 3110 > 3111 if check: > -> 3112 if not polynomial_y.is_irreducible(): > 3113 raise ValueError, "defining polynomial (%s) > must be irreducible"%polynomial > 3114 > > /home/grout/sage/polynomial_element.pyx in > sage.rings.polynomial.polynomial_element.Polynomial.is_irreducible() > > /home/grout/sage/polynomial_element.pyx in > sage.rings.polynomial.polynomial_element.Polynomial.factor() > > /home/grout/sage/gen.pyx in sage.libs.pari.gen._pari_trap() > > <class 'sage.libs.pari.gen.PariError'>: (8) > > > > -Jason > > > > > -- John Cremona --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---