The magnetic scalar potential for a rectangular prism
We analytically solve Poisson's equation for the magnetic scalar potential generated by a uniformly magnetized rectangular prism and determine a closed-form solution for the magnetic scalar potential given only in terms of arctan and natural logarithmic functions. We show that the magnetic scalar potential can be written as a demagnetization vector, containing all the geometric information, multiplied with the magnetization, analogous to demagnetization tensors. We validate the derived analytical expression for the magnetic scalar potential by comparing with a finite element simulation and show that these agree perfectly. We finally extend the concept of the demagnetization vector and tensor, which contains the geometric information for the source generating the potential, to gravitational objects.