# Elementary vector calculus: Divergence of a field

How do you find the divergence of a field $f(\vec{r})=\vec{r}\exp(r^2)$ where $\vec{r}$ is the position vector and $r$ is its magnitude? In other words, how does one evaluate $\nabla\cdot[\vec{r}\exp(r^2)]$? I think we could do it by writing $f(\vec{r})$ as a column vector and differentiating each component wrt their variable and I get $\exp(r^2)(3+2r^2)$ is that right? Is there a quicker way to do this?

-

The divergence of a field is symbolically written as $$\nabla\cdot f\tag{1}$$ since, in $\mathbb{R}^3$, $\nabla=\mathbf{i}\frac{\partial}{\partial x}+\mathbf{j}\frac{\partial}{\partial y}+\mathbf{k}\frac{\partial}{\partial z}$, and taking the symbolic dot product with $f=\mathbf{i}f_1+\mathbf{j}f_2+\mathbf{k}f_3$ yields $$\frac{\partial}{\partial x}f_1+\frac{\partial}{\partial y}f_2+\frac{\partial}{\partial z}f_3\tag{2}$$ In your function, $$\begin{array}{}f_1=xe^{x^2+y^2+z^2}&f_2=ye^{x^2+y^2+z^2}&f_3=ze^{x^2+y^2+z^2}\end{array}\tag{3}$$ So \begin{align} \nabla\cdot f &=(1+2x^2)e^{x^2+y^2+z^2}+(1+2y^2)e^{x^2+y^2+z^2}+(1+2z^2)e^{x^2+y^2+z^2}\\ &=(3+2r^2)e^{r^2}\tag{4} \end{align} which is exactly what you got.
As for a "quicker way," you could have precomputed that for $f(\vec{r)}=\vec{r}g(r)$, \begin{align} \nabla\cdot f &=3g(\vec{r})+\vec{r}\cdot\nabla g(\vec{r})\tag{5} \end{align} and that might make the computation of $(4)$ easier.