How to define a Derivative[] wrt implicit parameterized variables?

 How to define a Derivative[] wrt implicit parameterized variables?

I know how to define derivatives for explicit variables:

Derivative[n_, 1][p][x_, v_] := D[p[x, v], {x, n + 2}]/2;
D[p[x, v], {x, 3}, {v, 4}]

Output: $ \frac{1}{16} p^{(11,0)}(x,v)$

But I can’t figure out how to adapt the syntax so that I can define a derivative of f[x] wrt a subscripted or implicit variable:

gau[x_, v_] := Exp[-(x^2)/(2*v)]/Sqrt[2*Pi*v];
f[x_] := Sum[gau[x - m[i], v[i]], {i, 1, n}]/n;
D[f[x], v[j]]

(* 0 *)

I can force a result for a specific n and j, but I want a general expression:

n = 3;
D[f[x], v[2]]

Output: $ \frac{1}{3} \left(\frac{(x-m(2))^2 e^{-\frac{(x-m(2))^2}{2 v(2)}}}{2 \sqrt{2 \pi } v(2)^{5/2}}-\frac{e^{-\frac{(x-m(2))^2}{2 v(2)}}}{2 \sqrt{2 \pi } v(2)^{3/2}}\right)$

I also know I could hack the Sum[] function as described HERE, but that’s only a partial solution, and for my purposes it would work better to just explicitly define the derivative.

So, how can I define a Derivative wrt v[j] of f[x], when the v’s are implicit and j is a general subscript?

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange