[Physics] Why does the side of two magnet attract

electromagnetismmagnetic fields

I have two magnetic bars and when they are brought close sideway the two bars join where the two South poles are adjacent to each other, and so does the two North poles. If the magnetic field goes from South to North and repel when is the same pole, why doesn't the magnetic bar rotate and align itself to NSNS?

enter image description here

Best Answer

yes i also have seen the same thing

i had two same magnets whose shape was as that of cylinder but with the ends curved and it may look like extremely stretched egg.

anway if i throw them both in the air they will attract and stick towards each other horizontally

i am very confused by that if their poles are at the ends

but if their poles are not at the end of their lengths but along the middle portion , that may explain the observation