Simulation of End Effects in a Superconductive Magnet with a Ferromagnetic Core