Ask Your Question

ibayer's profile - activity

2020-04-08 20:33:13 +0100 received badge  Notable Question (source)
2017-10-04 11:19:29 +0100 received badge  Popular Question (source)
2014-01-11 14:31:13 +0100 commented answer derivative of multivariate equation with nested sum

Thanks for your answer this is a nice approach for an intermediate solution. p and k are indeed variables and I'm looking more for a solution like $\frac{\partial y(x,v)}{\partial v_{l,f}} = x_l \sum_{j\neq l} v_{j,f} x_j$ . Maybe this is a situation where its just simpler to do it by hand and and use finite difference to check if the gradient is correct...

2014-01-11 14:21:26 +0100 received badge  Supporter (source)
2013-12-30 13:37:39 +0100 received badge  Editor (source)
2013-12-30 13:36:27 +0100 asked a question 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