Delta2 said:
@TSny I have done the calculation of the line integral presented at my post #5 (with origin at the left down corner of the square loop) and I get a result that matches your result in post #6.
Good!
But I believe the line integral (as well as the volume integral) are independent of the origin of the coordinate system we choose to do the calculations.
For the usual case where you have a loop where the current has the same magnitude at every point and the current flows in only one direction around the loop, the magnetic moment ##\vec m## will be independent of the choice of origin. However, for the square loop in this problem, ##\vec m## will depend on the location of the origin.
Consider your formula from post #5: ##\,\,\, \vec m = \frac{1}{2}\int_C I \,\vec r \times d\vec s##.
Here, ##d \vec s## is an element of displacement along the loop ##C##
in the direction of the current, and ##\vec r## is the location of the element relative to the origin. ##I## is the current at the location of the element ##d\vec s##.
Shift to a new origin and let ##\vec r'## denote positions of elements of the loop relative to the new origin. So, ##\vec r' = \vec r + \vec r_0##, where ##\vec r_0## is a constant vector. Then, relative to the new origin
##\vec m' = \frac{1}{2}\int_C I \, \vec r' \times d\vec s = \frac{1}{2}\int_C I\, \vec r \times d\vec s +\frac{1}{2}\int_C I \,\vec r_0 \times d\vec s = \vec m + \frac{1}{2} \vec r_0 \times \int_C I \, d\vec s##
So, ##\vec m' = \vec m## only if the expression ##\vec r_0 \times \int_C I \, d\vec s = 0##. For the typical current loop, ##\int_C I \, d\vec s = I \int_C d\vec s = 0##. But, for a loop with junctions, such as the square loop in this problem, ##\vec r_0 \times \int_C I \, d\vec s \neq 0## in general.