Cooray-Rubinstein formula for the evaluation of lightning radial electric fields: derivation and implementation in time domain