Two Bar Magnets

One bar magnet is suspended by a string while the other bar magnet can be brought close to the suspended one so that they either attract or repel each other.