Simplify algebraic fractions (#890)