Ask Your Question

Assombrance's profile - activity

2019-02-01 06:53:39 -0500 answered a question Norm in UniversalCyclotomicField

Hi again, this bug was marked as fixed in version 8.6, but I still encounter it in this same version :

Forcing sage-location, probably because a new package was installed.
Cleaning up, do not interrupt this.
Done cleaning.
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.6, Release Date: 2019-01-15                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: a = vector([E(8)])
sage: a.norm()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5b5ddb3f4c99> in <module>()
----> 1 a.norm()

/home/henri/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:12190)()
   1672             sqrt(5)
   1673         """
-> 1674         abs_self = [abs(x) for x in self]
   1675         if p == Infinity:
   1676             return max(abs_self)

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

Am I doing something wrong ?

2018-12-13 04:38:34 -0500 received badge  Student (source)
2018-12-12 04:20:12 -0500 received badge  Scholar (source)
2018-12-11 02:02:59 -0500 asked a question 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