|   | 1 |  initial version  | 
For the easier example, you may do:
sage: x=polygen(ZZ, 'x')
sage: K.<a>=NumberField(x^2+5)
sage: K.different()
Fractional ideal (2*a)
which returns the ideal generated by 2*a you are expecting.
|   | 2 |  No.2 Revision  | 
For the easier example, you may do:
sage: x=polygen(ZZ, 'x')
sage: K.<a>=NumberField(x^2+5)
sage: K.different()
Fractional ideal (2*a)
which returns the ideal generated by 2*a you are expecting.
For the original example, I am not familiar at all with the subject, but trying to adapt the example shown in the documentation of K.relative_different accessible online here, one can do:
sage: x = polygen(ZZ, 'x')
sage: K.<a> = NumberField(x^3-2)
sage: PK.<t> = K[]
sage: L.<zeta3> = K.extension(t^2+t+1)
sage: L.relative_different()
Fractional ideal ((1/3*a^2 + 2/3*a + 1/3)*zeta3 + 2/3*a^2 + 1/3*a - 1/3)
Or maybe you want the absolute different:
sage: L.absolute_different()
Fractional ideal ((-2*a^2 + 2*a - 2)*zeta3 - a^2 - 2*a - 4)
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.