Hydrogen atoms in the presence of a homogeneous magnetic field: a variational approach