ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 10 Dec 2018 10:22:04 -0600Norm in UniversalCyclotomicFieldhttp://ask.sagemath.org/question/44623/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 advanceAssombranceMon, 10 Dec 2018 10:22:04 -0600http://ask.sagemath.org/question/44623/Simplify vector vs. its normhttp://ask.sagemath.org/question/43470/simplify-vector-vs-its-norm/ In the following I compute the matrix `mrot` which shall rotate the vector `v` to the unit vector pointing into the x-direction. This does indeed work, except that the last printout for verification, `view(u*mrot)`, looks complicated, despite the fact that it should just be (1, 0, 0). How would I let sage reduce the enormous formulas for the vector components?
v1 = var('v1');
v2 = var('v2');
v3 = var('v3');
e1 = vector([1,0,0]);
v = vector([v1, v2, v3]);
u = v/v.norm();
#u = v;
view(["u=", u], sep=" ");
z=u.cross_product(e1);
#z=e1.cross_product(u);
view(["z=", z]);
c=u.dot_product(e1);
view(["c=",c]);
mat=Matrix( [[0, -z[3-1], z[2-1]], [z[3-1], 0, -z[1-1]], [-z[2-1], z[1-1], 0]] );
#view([mat, mat*mat]);
mrot=-(matrix.identity(3) + mat + (1/(1+c)) * mat*mat);
view(u*mrot);HaraldSat, 25 Aug 2018 15:40:11 -0500http://ask.sagemath.org/question/43470/complex normhttp://ask.sagemath.org/question/38289/complex-norm/As a newbie, I must be missing something, but here is the question:
With this setup:
var('a', domain=CC)
a.norm()
a.norm().simplify()
The last line displays as a^2, but should be |a|^2 .
What am I missing?normvcrMon, 17 Jul 2017 15:33:41 -0500http://ask.sagemath.org/question/38289/typeset complex norm is missing absolute valuehttp://ask.sagemath.org/question/38288/typeset-complex-norm-is-missing-absolute-value/ As a newbie, I must be missing something, but here is the question:
With this setup:
var('a', domain=CC)
a.norm()
a.norm().simplify()
The last line displays as a^2, but should be |a|^2 .
What am I missing?normvcrMon, 17 Jul 2017 15:32:20 -0500http://ask.sagemath.org/question/38288/1-Norm Matrix, Vektorhttp://ask.sagemath.org/question/32296/1-norm-matrix-vektor/Is the a way to specifiy the norm of Matrix or Vektor?
I need the 1-norm
A.norm(1)?
v.norm(1)? Something like thisthethaWed, 20 Jan 2016 06:32:12 -0600http://ask.sagemath.org/question/32296/Number Fields and the Normhttp://ask.sagemath.org/question/8343/number-fields-and-the-norm/Hello,
I am currently very confused about how to use [Number Fields in Sage].(http://www.sagemath.org/doc/reference/sage/rings/number_field/number_field.html).
Things are not working.
Specifically I would like the norm of $\mathbb{Z}[\zeta_5]$ which should be a homogeneous polynomial of degree 4.
I tried:
>K.<g> = NumberField(1+x+x^2+x^3+x^4)
>a,b,c,d=var('a b c d')
>(a+b\*g+c\*g^2+d\*g^3).norm()
However that did not work.
I also tried:
>K.<g>=CyclotomicField(5); K
>a,b,c,d=var('a b c d')
>(a+b\*g+c\*g^2+d\*g^3).norm()
Instead of returning the norm in the Cyclotomic ring, this simply gave me the norm over the complex numbers, that is multiplication by the complex conjugate. These two things are very different, and the norm of the complex number is not at all correct. (It should be degree 4 not degree 2)
Any help is greatly appreciated, thank youEric NaslundMon, 26 Sep 2011 07:21:30 -0500http://ask.sagemath.org/question/8343/symbolic vector normhttp://ask.sagemath.org/question/8804/symbolic-vector-norm/I can't get Sage to produce the norm or even just compute `w[1]^2` in the code below. I keep getting a "not implemented" error. Have I made a simple mistake here, or is there a way around this? Thanks for the help. I haven't done much with matrix computations in Sage yet and am trying to learn my way around.
var('x,y')
a=matrix([[1,2],[-3,0]])
v=vector([x,y])
w=a*v.column()
w.norm()calc314Mon, 19 Mar 2012 10:25:19 -0500http://ask.sagemath.org/question/8804/Norm in a quadratic spacehttp://ask.sagemath.org/question/8763/norm-in-a-quadratic-space/Hi
I'm working in a vector space where the inner product is not the usual one and I would need to access directly to the norm induced by inner product. I found how to create such a space but the 'norm' function gives me the usual norm, which is not the one I want.
Here is an example :
SP=matrix(QQ,[[2,0],[0,3]])
V=VectorSpace(QQ,2,inner_product_matrix=SP)
What I want to compute is e.g.
e0=V.0
e0.inner_product(e0)
while `e0.norm()` gives me 1 (wrong answer for me)
I assume this should be possible directly. Any idea how ?
Thanks,BertrandThu, 01 Mar 2012 04:29:43 -0600http://ask.sagemath.org/question/8763/