Optimizing Polynomial Expressions by Algebraic Factorization and