We present an artificial swimmer consisting in a long cylinder of ferrogel
which is polarized transversely and in opposite directions at each extremity.
When it is placed on a water film and submitted to a transverse oscillating
magnetic field, this artificial worm undulates and swims. Whereas symmetry
breaking is due to the field gradient, the undulations of the worm result from
a torsional buckling instability as the polarized ends tend to align with the
applied magnetic field. The critical magnetic field above which buckling and
subsequent swimming is observed may be predicted using elasticity equations
including the effect of a magnetic torque. As the length of the worm is varied,
several undulation modes are observed which are in good agreement with the
bending modes of an elastic rod with free ends