A stable numerical method to simulate array induction and measurement-while-drilling (MWD) logs is presented. The algorithm is based on a horizontal eigenmode expansion method. Mode propagation in the vertical direction is described by three-layer modules. Within each module, general transmission and reflection coefficients are obtained by tracing the propagation of the modes. The multilayer cases are treated as a cascade of such modules. Owing to the mode-tracing algorithm, numerical stability and efficiency are superior to the other methods. This numerical algorithm is applied to the simulation of array induction and MWD logs in formations with both vertical and horizontal layers.