3594:factor should return unhandled expr unchanged
don't expand for other functions like sqrt
remove trailing whitespace