I wrote some examples of plotting paramaterized paths in pgfplots yesterday: Drawing Functions on Spheres. If you have a closed-form parametric solution, you should be able to plot it and the magnets the same way. You might want to look at quiver plots for the field lines.
If you’re saying you want to calculate a Bezier curve from control points and plot that, Matlab and Octave can solve that and export the plot in TikZ format (I give an example of exporting from those programs at the link above). If you want to try something like that in pgfplots, the example on page 352 of the pgfplots manual might be helpful.
(On second look, your illustration shows I’m overcomplicating things.)
pgfplotsis with\addplot+[smooth] coordinates {...};– Davislor Sep 03 '15 at 08:41