On May 29, 5:11 am, Gaëtan Bisson <[EMAIL PROTECTED]> wrote:
> Carl Witty wrote :
>
>
>
> > > For instance:
> > >   R.<a,b> = NumberField(x^2-3,'g')[]
> > >   S.<y> = R.fraction_field()[]
> > >   xgcd(y^2, a*y+b)
>
> > > returns the error: (more below)
> > >   <type 'exceptions.TypeError'>: unsupported operand type(s) for %: 
> > > 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
> > >  and 
> > > 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
>
> > This should work, but doesn't due to a bug (well, perhaps you could
> > call it a missing feature instead).  I've posted a patch here,
> >http://trac.sagemath.org/sage_trac/ticket/3327so this will work in
> > some future version of Sage (likely the next version, assuming that
> > somebody positively reviews my patch).
>
> Thank you so much. The patch is indeed working fine.
>
> I still have issues when involving a tower of number fields, though.
> That is, the following code:
>
>   R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[]
>   h = R.base_ring().gen()    
>   S.<y> = R.fraction_field()[]
>   xgcd(y^2, a*h*y+b)
>
> raises the error:
>   NameError: name 'h' is not defined
>
> Note, however, that when the first line is replaced by:
>   R.<a,b> = NumberField(x^2-3,'h')[]
> computations run flawlessly and SAGE outputs the result:
>   (b^2/(3*a^2), 1, ((-1)/(h*a))*y + b/(3*a^2))
>
> Do I have to define 'h' in a more "robust" way to avoid that
> or is this unrelated to the way it's defined?

This is not yet implemented.

Sage keeps its fraction field elements in reduced form, by performing
GCDs between the numerator and denominator.  Sage uses Singular to
find the GCD of multivariate polynomials, but Singular does not
support towers of number fields.  The above traceback shows Sage
trying, and failing, to use Singular with towers of number fields.

I've opened a couple of bug reports for this example,
http://trac.sagemath.org/sage_trac/ticket/3329 and
http://trac.sagemath.org/sage_trac/ticket/3330; the first just says
there should be a better error message, and the second requests an
actual implementation.

Until somebody fixes the code (maybe you want to work on it
yourself?), probably the best solution is to convert your tower of
number fields into a single absolute number field and do the
computation with this single field.  You can do this with
the .absolute_field() method, and convert back and forth using the
isomorphisms from the .structure() method on the absolute field.

sage: K = NumberField(x^2-3,'g').extension(x^2-7,'h')
sage: Kabs = K.absolute_field('j'); Kabs
Number Field in j with defining polynomial x^4 - 20*x^2 + 16
sage: Kabs.structure()

(Isomorphism from Number Field in j with defining polynomial x^4 -
20*x^2 + 16 to Number Field in h with defining polynomial x^2 - 7 over
its base field,
 Isomorphism from Number Field in h with defining polynomial x^2 - 7
over its base field to Number Field in j with defining polynomial x^4
- 20*x^2 + 16)

Carl

--~--~---------~--~----~------------~-------~--~----~
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