1 | initial version |

Thank you for your report, this is indeed a bug. Now tracked at

As a workaround,

one could convert

`a`

to a vector over the field of algebraic numbers; then the norm is given as an exact algebraic number:`sage: a = vector([E(8), E(7)]) sage: b = a.change_ring(QQbar) sage: bn = b.norm() sage: bn 1.414213562373095? sage: bn.parent() Algebraic Real Field`

one could convert

`a`

to a vector over a cyclotomic field (not the universal one); sadly the norm is then given as an inexact (floating-point) number:`sage: a = vector([E(8), E(7)]) sage: c = a.apply_map(lambda x: x.to_cyclotomic_field()) sage: cn = c.norm() sage: cn 1.41421356237310 sage: cn.parent() Real Field with 53 bits of precision`

the square of the norm of the vector

`a`

can be obtained directly as`a * a.conjugate()`

, but one then gets it as an element in the universal cyclotomic field, and a similar bug prevents from taking the square root of that directly:`sage: a = vector([E(8), E(7)]) sage: ann = a * a.conjugate() sage: ann 2 sage: ann.parent() Universal Cyclotomic Field sage: an = sqrt(ann) Traceback (most recent call last) ... NotImplementedError: is_square() not implemented for elements of Universal Cyclotomic Field`

and one again has to go through a cyclotomic field other than the universal one, or the field of real algebraic numbers:

`sage: nna = AA(a*a.conjugate()) sage: nna 2 sage: nna.parent() Algebraic Real Field sage: na = sqrt(nna) sage: na 1.414213562373095? sage: na.parent() Algebraic Real Field`

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.