Improved traversal for replacing nodes in simplify
Improved traversal for replacing nodes in simplify

Replaced the two-pass traversal with a single pass, which stops once it
replaces a node.

josdejong/mathjs,josdejong/mathjs,FSMaxB/mathjs,josdejong/mathjs,josdejong/mathjs,josdejong/mathjs,FSMaxB/mathjs,FSMaxB/mathjs,FSMaxB/mathjs,FSMaxB/mathjs