1
$\begingroup$

Is it possible to get symbolic derivatives of equations with vectors as arguments without specifying every vector element explicitly.

Something like

f[A_Vector, B_Vector] := Dot[A, B]
D[f[a, b], a[[1]]]
$\endgroup$
1
$\begingroup$

The vector elements just need to be specified symbolically. This can be done implicitly by specifying the dimension of the vectors.

f[a_,b_,n_]:=Dot[Table[Subscript[a, i],{i,1,n}],Table[Subscript[b, i],{i,1,n}]]
D[f[a, b, 5], Subscript[a, 1]]

Subscript[b, 1]

Which looks nicer in the notebook: enter image description here

$\endgroup$
  • $\begingroup$ Yes, this works of course but I would like to get the result in terms of the input vectors a and b. $\endgroup$ – paw Jul 19 '14 at 14:18
  • $\begingroup$ @paw May you add an example of the desired output for clarification. $\endgroup$ – Karsten 7. Jul 19 '14 at 15:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.