Finite‐element analysis of electron waveguide discontinuities with arbitrary potential and effective mass distributions