Ask Your Question

Revision history [back]

Norm in UniversalCyclotomicField

Hi,

I'm trying to work with vectors in the UniversalCyclotomicField, But I can't find a way to make the norm work. I'm writing the following code :

sage: a = vector([E(8)])
sage: a.norm()

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5b5ddb3f4c99> in <module>()
----> 1 a.norm()

/home/[name]/SageMath/local/lib/python2.7/site-packages/sage/modules/free_module_element.pyx in sage.modules.free_module_element.FreeModuleElement.norm (build/cythonized/sage/modules/free_module_element.c:12840)()
   1671             sqrt(5)
   1672         """
-> 1673         abs_self = [abs(x) for x in self]
   1674         if p == Infinity:
   1675             return max(abs_self)

TypeError: bad operand type for abs(): 'UniversalCyclotomicField_with_category.element_class'

And having no luck with it. Does any of you know a workaround allowing me to stay in exact calculations ?

Thanks in advance

Norm in UniversalCyclotomicField

Hi,

I'm trying to work with vectors in the UniversalCyclotomicField, But I can't find a way to make the norm work. I'm writing the following code :

sage: a = vector([E(8)])
sage: a.norm()

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5b5ddb3f4c99> in <module>()
----> 1 a.norm()

/home/[name]/SageMath/local/lib/python2.7/site-packages/sage/modules/free_module_element.pyx in sage.modules.free_module_element.FreeModuleElement.norm (build/cythonized/sage/modules/free_module_element.c:12840)()
   1671             sqrt(5)
   1672         """
-> 1673         abs_self = [abs(x) for x in self]
   1674         if p == Infinity:
   1675             return max(abs_self)

TypeError: bad operand type for abs(): 'UniversalCyclotomicField_with_category.element_class'

And having no luck with it. Does any of you know a workaround allowing me to stay in exact calculations ?

Thanks in advance

Norm in UniversalCyclotomicField

Hi,

I'm trying to work with vectors in the UniversalCyclotomicField, But I can't find a way to make the norm work. I'm writing the following code :

sage: a = vector([E(8)])
sage: a.norm()

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5b5ddb3f4c99> in <module>()
----> 1 a.norm()

/home/[name]/SageMath/local/lib/python2.7/site-packages/sage/modules/free_module_element.pyx in sage.modules.free_module_element.FreeModuleElement.norm (build/cythonized/sage/modules/free_module_element.c:12840)()
   1671             sqrt(5)
   1672         """
-> 1673         abs_self = [abs(x) for x in self]
   1674         if p == Infinity:
   1675             return max(abs_self)

TypeError: bad operand type for abs(): 'UniversalCyclotomicField_with_category.element_class'

And having no luck with it. Does any of you know a workaround allowing me to stay in exact calculations ?

Thanks in advance