derivative of multivariate equation with nested sum
Hello,
I often have to deal with functions like the one below, take derivatives and so on. I would really like to know if I could use a CAS like SAGE to do this tedious and error prone calculations but I couldn't find a similar kind of function in the docs and tutorials.
My questions are:
- how can I write this function in SAGE ?
for $x\in \mathbf{R}^p; v \in \mathbf{R}^{p \times k}$
$$y(x, v) := \sum^p_{i=1} \sum^p_{j>i} \sum_{f=1}^k v_{i,f} v_{j,f} x_i x_j =
\sum^p_{i=1} \sum^p_{j>i} \langle v_{:,i}, v_{;,j} \rangle x_i x_j$$
- calculate the partial derivatives $\frac{\partial y(x,v)}{\partial v_{i,j}}$ ?
- or the the derivative with respect to the column-vector $\frac{\partial y(x,v)}{\partial v_{:, i} }$ ?
Or is there a better way to work with this kind of function in SAGE? (the function above is only an example)
Thanks