# Inverse gradient as line integral in Mathematica

I found a nice paper about inverse vector operators here. I have successfully defined a Mathematica function for inverse curl and inverse divergence, however I can't figure out how to do inverse gradient (page 7 in the paper). According the paper, the inverse gradient can be computed as a path independent line integral, but in my attempts I got improper results. The paper doesn't show up an example for it and I'm not really familiar with line integrals.

If anyone could help me I would be really thankful. In the answer please be aware the fact that I'm not a math guy.

When ${\bf A}=\nabla f$ in some region $\Omega\subset{\mathbb R}^3$ then for any curve $\gamma\subset\Omega$ with initial point ${\bf p}$ and endpoint ${\bf q}$ one has $$f({\bf q})-f({\bf p})=\int_\gamma {\bf A}\cdot d{\bf x}\ .\tag{1}$$ This is the $3$-dimensional version of the familiar formula $$f(q)-f(p)=\int_p^q f'(t)\>dt$$ from elementary calculus.
Now in your setting we are given a vector field ${\bf A}$ in some region $\Omega\subset{\mathbb R}^3$, and we are assured that ${\bf A}=\nabla f$ for some $f:\>\Omega\to{\mathbb R}$. This $f$ is only determined up to an additive constant anyway; therefore we may fix $f({\bf p}_0)$ for some point ${\bf p}_0\in\Omega$ arbitrarily. But then $(1)$ says that for any point ${\bf q}\in\Omega$ one has $$f({\bf q})=f({\bf p}_0)+\int_{{\bf p}_0}^{\bf q}{\bf A}\cdot d{\bf x}\ ,$$ where the right hand side can be computed along any curve $\gamma$ connecting ${\bf p}_0$ with ${\bf q}$. When the segment $[{\bf p}_0,{\bf q}]$ is contained in $\Omega$ then one may take for $\gamma$ this segment, having the parametrization $$\gamma:\quad t\mapsto {\bf p}_0+t({\bf q}-{\bf p}_0)\qquad(0\leq t\leq1)\ .$$