Modeling and Measurement of the Differential Resistance and Ideality Factors in Heterostructure Light Emitting Diodes and Laser Diodes