Numerical Analysis of Magnetohydrodynamic Instabilities by the Finite Element Method