vector and matrix valued functions
- To: mathgroup at smc.vnet.net
- Subject: [mg105771] vector and matrix valued functions
- From: Daniel <dalist0 at gmail.com>
- Date: Fri, 18 Dec 2009 06:22:50 -0500 (EST)
Hello, I am working with functions that have vector and matrix valued arguments. I'd like to postpone going to a component representation as late as possible, but that is not easy because some vectors are already in the component form and this gives me error messages from cross and times. One example: I have several vector valued quantities x,y,z (let's say 100 dimensional). I'd like to write all expressions in the form f[x_,y_]:=x.y instead of f[x1_,x2_,...,_x100,y1_,...]:=... The problem is, that in the first case the system does not know it is dealing with 100 dimensional vectors. g[x_] :=5 x Cross[g[a] , {1, 0, 0}] should give me something like g[a] x {1,0,0}, e.g. stay unevaluated or alternatively be evaluated in component form {0, 5 a3, - 5 a2}. Instead I get an error message: Cross::nonn1: The arguments are expected to be vectors of equal length, and the number of arguments is expected to be 1 less than their length In addition, I'd like to write the gradient of a function with one or several vector arguments, i.e. something like gradient_y f, which should be a vector with the components df/dy_i, i.e. D[f[x,y], {{y1,y2,y3,...y100}}]. This does not work either, because the system does not now that y is in reality {y1,..,y100} How can I deal naturally with vectors, e.g. have vector valued variables as function arguments and return values, use the usual vector functions (cross, dot, grad, div, rot), and diff with respect to a vector. Many thanks Dan