# Work and line integral

@TSny I had a mistake in the power of y. Now I get:

$$g(y,z) = \int 0 dy + h(z) = 0 + h(z) \\ \implies \frac{\partial \phi}{\partial z} = \frac{\partial h(z)}{\partial z} = -cz^3 \\ \implies h(z) = -c \int z^3 dz = \frac{-c}{4} z^4 + C \\ \implies \phi = -\frac{a}{2}x^2y^3 - \frac{c}{4} z^4 + C$$

@haruspex Now trying to do the integral properly:

$$\phi = - \int \vec{F} d\vec{r} = - (\frac{a}{2} x^2y^3 + \frac{a}{2} x^2y^3 + \frac{c}{4} z^4 + C) \\ = - ax^2y^3 - \frac{c}{4} z^4 + C$$

Now that's only a little different from the other one, but I'm still searching for the mistake.

Thanks a lot to both of you for helping me.

Julien.

Last edited:
What I see is that only the first solution in my last post satisfies the equation ## \vec{F} = -(\frac{\partial \phi}{\partial x},\frac{\partial \phi}{\partial y},\frac{\partial \phi}{\partial z})##. It's very frustrating for me to not find the mistake in the integration though.

haruspex
Homework Helper
Gold Member
What I see is that only the first solution in my last post satisfies the equation ## \vec{F} = -(\frac{\partial \phi}{\partial x},\frac{\partial \phi}{\partial y},\frac{\partial \phi}{\partial z})##. It's very frustrating for me to not find the mistake in the integration though.
I was wrong to say what you were doing in post #20 was ok. That integral is not a valid way to find the potential, as you discovered.

JulienB
@haruspex Ah okay! No problem, the most I learn comes from the mistakes I make. Thanks for your advices!

TSny
Homework Helper
Gold Member
##\phi = - \int \vec{F} \cdot d\vec{r}##

This will get you ##\phi## as long as ##d\vec{r}## represents a displacement along a path that takes you from some reference point to the point (x, y, z) where you want to know ##\phi(x, y, z)##. So, the components of ##d\vec{r}## are not independent during the integration. But you can pick any path you want. For example, you can take the origin as the reference point and then integrate along the x axis to (x, 0, 0), then integrate parallel to the y axis to (x, y, 0), and then integrate parallel to the z axis to (x, y, z).

haruspex
Homework Helper
Gold Member
@haruspex Ah okay! No problem, the most I learn comes from the mistakes I make. Thanks for your advices!
This thread got me interested in how to find the potential from the field. I came up with this. Let the independent variables be xi. We know the functions ##\phi_{x_i}##, the subscript denoting partial derivative. I'll abbreviate that to ##\phi_i##.
##\phi=\Sigma \int \phi_i.dx_i-\Sigma_{i<j} \int\int \phi_{ij}.dx_i.dx_j+\Sigma_{i<j<k} \int\int\int \phi_{ijk}.dx_i.dx_j.dx_k ...##.
No doubt this is a known result, just not known to me. It's analogous to the principle of inclusion and exclusion.
But in most cases, it will be far simpler just to spot the potential function with a little trial and error.

Interestingly, it produces an answer even where no potential function exists. This is because it assumes that the function produced by differentiating the given ##\phi_1## wrt x2 will match that obtained by differentiating the given ##\phi_2## wrt x1

Last edited:
TSny
Homework Helper
Gold Member
##\phi=\Sigma \int \phi_i.dx_i-\Sigma_{i<j} \int\int \phi_{ij}.dx_i.dx_j+\Sigma_{i<j<k} \int\int\int \phi_{ijk}.dx_i.dx_j.dx_k ...##
Interesting. ...took me a while to digest this . It does look right. I believe each summation term just yields ##\phi## multiplied by a binomial coefficient. Factoring out ##\phi##, you get ##\phi## multiplied by the sum of the coefficients (with the alternating signs). The sum of the coefficients gives 1, so the entire expression reduces to ##\phi##. I've never seen a function expressed this way.

haruspex
Homework Helper
Gold Member
I believe each summation term just yields ϕmultiplied by a binomial coefficient.
Not exactly. Consider φ=xy+z. The first summation gives 2xy+z. The excess xy gets removed by the second summation.

TSny
Homework Helper
Gold Member
Not exactly. Consider φ=xy+z. The first summation gives 2xy+z. The excess xy gets removed by the second summation.
Yes, you are right. I was making the stupid mistake of thinking that taking the partial derivative of a function with respect to x, say, followed by integrating with respect to x would give back the function (up to a constant of integration). Certainly not!

TSny
Homework Helper
Gold Member
haruspex, I'm a little unsure of how to interpret the integrals in your expression. Suppose we have two independent variables ##x## and ##y## and we want to give meaning to the integral ##\int{(x+y)^2}dx##. Doing the integral with a ##u## substitution ##u = x + y## yields ##(x+y)^3/3##. But, instead, if I square out ##(x+y)^2## and then integrate, I get ##x^3/3 + x^2y + xy^2##. These results differ by ##y^3/3##, which can be considered a "constant of integration" since ##y## is held constant during the integration with respect to ##x##. So I'm having trouble seeing how the integrals in your expression lead to a definite result.

haruspex
Homework Helper
Gold Member
Yes, you are right. I was making the stupid mistake of thinking that taking the partial derivative of a function with respect to x, say, followed by integrating with respect to x would give back the function (up to a constant of integration). Certainly not!
Fwiw, it can be written in vector notation as ##\phi=\int \vec\nabla.\vec{dr}-\int\int (\vec \nabla\times\vec\nabla)\phi.(\vec{dr}\times\vec{dr})+\int\int\int \wedge^3\vec \nabla\phi.\wedge^3\vec{dr}##, where ##\wedge^3\vec v## stands for the triple scalar product ##\vec v.\vec v\times\vec v## (by analogy with the exterior product).

haruspex
Homework Helper
Gold Member
haruspex, I'm a little unsure of how to interpret the integrals in your expression. Suppose we have two independent variables ##x## and ##y## and we want to give meaning to the integral ##\int{(x+y)^2}dx##. Doing the integral with a ##u## substitution ##u = x + y## yields ##(x+y)^3/3##. But, instead, if I square out ##(x+y)^2## and then integrate, I get ##x^3/3 + x^2y + xy^2##. These results differ by ##y^3/3##, which can be considered a "constant of integration" since ##y## is held constant during the integration with respect to ##x##. So I'm having trouble seeing how the integrals in your expression lead to a definite result.
Yes, that needs to be clarified. I take the integrals to be analogous to partial derivatives, so integration dx treats y and z as constants.

TSny
Homework Helper
Gold Member
Yes, that needs to be clarified. I take the integrals to be analogous to partial derivatives, so integration dx treats y and z as constants.
Yes, that's how I was interpreting the integrals. I just don't see how to decide on the "arbitrary functions of integration". I will think some more about it tomorrow.

haruspex