Text S1.

Figure 1(a) shows the magnetic field surrounding a grade N52 neodymium bar magnet, which we modeled as a rectangular parallelepiped of size Lx=4 cm, Ly=4 cm, and Lz=2 cm, in the x, y, and z directions, respectively. The magnet is permanently magnetized along the z direction, with a surface field of 0.5 T. The magnetic field surrounding the magnet is plotted on the y-z plane. For these calculations, we used the MATLAB routine FieldBar.m, by Cébron (2021). This routine implements the analytical equations provided in the section 2.5 of Camacho and Sosa (2013) but corrects for an error in the equation of the magnetic field along the y direction and an error in the calculation of the magnetic field inside the magnet [for details see Cébron (2021)]. The equations by Camacho and Sosa (2013) are an adaptation for a rectangular prism magnetized along the z direction of the results obtained by Yang et al. (1990) for a rectangular prism magnetized along the x direction. The same routine was also used for the results presented in Figure 1(b).