- #1
decerto
- 87
- 2
I have a function
$$\displaystyle V(x)=\frac{1}{2}\sum_i \sum_{j \neq i} q_i q_j \frac{1}{\left|r_i - r_j\right|}$$ where ##r_i=\sqrt{x_i^2+y_i^2+z_i^2}## which is the coulomb potential energy of a system of charges.
I need to calculate ##\frac{\partial V}{\partial x_k}## and ##\frac{\partial^2 V}{\partial x_k \partial x_l}## for an optimization routine.
I guess I want to treat the set ##(x_i , y_i, z_i)## where i runs from 1 to N as independent variables ##(x_j)## where j runs from 1 to 3N (the direct sum of the position vectors).
Would ##r_i = \sqrt{x_{3i-2}+x_{3i-1}+x_{3i}}## then?
I ask because but I am not sure how to calculate the ##\frac{\partial r_i}{\partial x_k}## term
I was also thinking maybe I can just calculate ##\frac{\partial r_i}{\partial x_k}, \frac{\partial r_i}{\partial y_k}, \frac{\partial r_i}{\partial z_k}## separately and then just relabel them as independent variables but I am not sure if this will work.
Any help would be appreciated
$$\displaystyle V(x)=\frac{1}{2}\sum_i \sum_{j \neq i} q_i q_j \frac{1}{\left|r_i - r_j\right|}$$ where ##r_i=\sqrt{x_i^2+y_i^2+z_i^2}## which is the coulomb potential energy of a system of charges.
I need to calculate ##\frac{\partial V}{\partial x_k}## and ##\frac{\partial^2 V}{\partial x_k \partial x_l}## for an optimization routine.
I guess I want to treat the set ##(x_i , y_i, z_i)## where i runs from 1 to N as independent variables ##(x_j)## where j runs from 1 to 3N (the direct sum of the position vectors).
Would ##r_i = \sqrt{x_{3i-2}+x_{3i-1}+x_{3i}}## then?
I ask because but I am not sure how to calculate the ##\frac{\partial r_i}{\partial x_k}## term
I was also thinking maybe I can just calculate ##\frac{\partial r_i}{\partial x_k}, \frac{\partial r_i}{\partial y_k}, \frac{\partial r_i}{\partial z_k}## separately and then just relabel them as independent variables but I am not sure if this will work.
Any help would be appreciated
Last edited by a moderator: