Ask Your Question

Revision history [back]

Repeating your input:

sage: var('x y')
(x, y)
sage: m = matrix(QQ,[[1,1],[-1,-1],[-1,1]])
sage: ch = ([-1,1,1])
sage: rv = vector([x,y])
sage: k = m.nrows()
sage: u = [(rv-m[i]).norm() for i in range(k)]

yields no output, unless we ask for u:

sage: u
[sqrt(abs(x - 1)^2 + abs(y - 1)^2),
 sqrt(abs(x + 1)^2 + abs(y + 1)^2),
 sqrt(abs(x + 1)^2 + abs(y - 1)^2)]

Of course, if the definition for u has .norm instead of .norm(),

sage: u = [(rv-m[i]).norm for i in range(k)]

then we would get:

sage: u
[<built-in method norm of Vector_symbolic_dense object at 0x10f76fb48>,
 <built-in method norm of Vector_symbolic_dense object at 0x10f76fbb0>,
 <built-in method norm of Vector_symbolic_dense object at 0x10f76fc18>]

If you are working in the notebook, maybe you evaluated

u = [(rv-m[i]).norm for i in range(k)]

and then changed it to

u = [(rv-m[i]).norm() for i in range(k)]

but forgot to reevaluate?