Question: Symbolic differentiation with respect to a vector.

I have the following equation: I need to symbolically differentiate the following equation with respect to the coordinates r[i] and r[i+1]. Es[i] := 1/2 * l[i] * Ks * ( 1 / l[i] * ( DotProduct( ( r[i+1] - r[i] ) , ( r[i+1] - r[i] ) ) )^0.5 -1)^2 where: r[i] := [ x[i], y[y], z[i] ]; r[i+1] := [ x[i+1], y[y+1], z[i+1] ]; l[i] and Ks are constants. The equation in its current form calculates the scalar (Stretch) energy over a FEM element. Differentiation with respect to the coordinates (r[i] and r[i+1]) should result in the Forces, with respect to coordinates, the result should be a vector function defining the force in x, y and z coordinates. with(VectorCalculus) r[i] :=
Please Wait...