# partial derivative with absolute value

I have a simple question about the partial derivative of a function including an absolute value. I am reading a book and there is a summation:

$$A = β\sum_\textbf{x} ||\textbf{x}||^n r(\textbf{x})$$ where $n \in \mathbb{R}_{\geq 0}$, $\beta \in \mathbb{R}_{\geq 0}$ and $\textbf{x} = (x_0, x_1, ... , x_{M−1})^T$. My question is: Can I treat the elements $||\textbf{x}||^n$ from summation as a constant during the partial derivative in relation to $r(\textbf{x})$, obtaining: $$\frac{\partial A(\textbf{x})}{\partial r(\textbf{x})} = β||\textbf{x}||^n$$?

If you define the function as $H(x, y) = \beta \|x\| y$, then $A(x) = H(x, r(x))$ and
$$\partial_{r(x)}H(\|x\|, r(x)) = \beta \|x\|$$ also, you need to be carefull with the sum. If it is on a finite set then
$$\frac{\partial A(x)}{\partial r(\textbf{x})} = β\sum_x||\textbf{x}||^n$$
Don't forget to remember that $$\frac{\partial A(x)}{\partial x} = \sum_x \partial_{x}H(\|x\|, r(x)) + \partial_{r(x)}H(\|x\|, r(x))$$