Gradient of next neighbor interaction

24 Views Asked by At

Is it correct to calculate the gradient of

$$f(x) = \sum_{i} g(x_i, x_{i+1})$$

simply by saying:

$$\nabla f(x) = (g(x_{i+1}), g(x_{i}))$$

Or is that completely wrong? (I assume it is)

Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

Consider the function $g = g(u,v)$ and note that for a given $1 < j < n$ ($n$ being the dimension of ${\bf x}$)

$$ f({\bf x}) = g(x_1, x_2) + \cdots + g(x_{j - 1}, x_j) + g(x_j, x_{j + 1}) + \cdots $$

So if you take the derivative w.r.t $x_j$ you will get

$$ \frac{\partial f}{\partial x_j} = \frac{\partial g}{\partial v}(x_{j - 1}, x_j) + \frac{\partial g}{\partial u}(x_j, x_{j + 1}) $$

The cases for $j = 1$ and $j = n$ are even easier. Will leave that to you