### Symbolic vectors

Edit: I've changed the question - upon editing the code the problem seems to lie elsewhere.

Let's say I have a vector space ~~V, ~~V of dimension n (which is variable) and a matrix M, and I want to understand the derivative of the function v -> ||M*v|| at some ~~point ~~vector v in V, and then evaluate it at tangent vectors.

As far as I can tell, the easiest way to do this is to use a symbolic vector v, then calculate ||M*v||, then take diff(), and then I can plug in a tangent vector.

~~As part of this, ~~So I would ~~then run~~write something like

~~x, y = var('x, y')
~~v = ~~vector([x,y])
~~list(var('v_%d' % i) for i in range(1,W.rank()+1))
def f(*v):
L = []
for var in v:
L.append(var)
return (M*vector(L)).norm()

~~if say V happens to be two-dimensional. This works fine in a new session, ~~but ~~if in the same session I've already used a vector space somewhere it says~~then diff(f) throws an error:

~~'sage.modules.free_module_element.FreeModuleElement_generic_sparse' object is not callable
~~unable to convert <function f at 0x7f2b046c5b90> to a symbolic expression

~~ ~~Why is that? And is there a better way to do this?