I connect the magnet to a 12V supply and give it ~560mA. I then put the small neodymium magnet (on the end of a plastic stick) close to the field of the electromagnet such that they repel. I am able to feel the field, but when the neodymium magnet gets somewhat close to the iron core it is drawn to it and sticks to it.
My confusion is, shouldn't the field of the electromagnet be strongest closer to the core and repel with even greater force? Why would it be drawn to it? Did the strong neodymium field realign the domains in the iron core when it got too close, and the get stuck to it?
Please let me know if my question doesn't make sense. I am an engineering student trying to understand the behavior I am seeing. My goal is to control the current of the electromagnet to crudely control the repulsion.