Cutoff frequencies in planar optical waveguides with arbitrary index profiles: An efficient numerical method