In the study of piezoelectric cantilever energy harvesting system, a bi-stable nonlinear cantilever with magnets added to the structure has a wider frequency band response and a higher energy output efficiency. Hence, the calculation accuracy of the magnetic force on which the potential function and dynamics of the system depend is essential to predicting the output response and energy harvesting effect. In this work, we use a shape function to describe the relation between the deflections of an arbitrary point and the free-end point on the beam, and then calculate the trace and deflection angle of the beam's free-end by integrating the entire slope of the cantilever beam. The magnetic force is consequently derived from the magnets' real-time relative positions and postures by using the magnetizing current method. With comprehensively considering the axial magnetic force and the lateral magnetic force, the simulation results demonstrate that when the displacement of the magnet at the end of the beam is large enough, the directions of axial and lateral magnetic force change from repulsive to attractive, which leads to a large veer of the resultant magnetic force across two quadrants. So, it means that a smaller interval between magnets may not cause a larger deflection of the beam, and the magnetic force existing as attractive force could diminish the well space of potential function (that is, the distance between two equilibrium positions of the system). The experimental data in this work are nicely consistent with the simulation results. And in this work, we also make a comparison of the simulation results with those from our method and existing method, showing that the accuracy of the proposed method is much higher than that from the existing calculation method, especially in the scenario where the magnet at the end of the beam is far from the horizontal axis.