How to check how wel expression is factored?

asked 2016-11-28 16:13:55 -0500

jgrgt gravatar image

I'm trying to prototype an application that would guide students towards a correct factorization of an expression. An example: "Factorize 2*b^3*c^14 + 8*b^2*c^7 + 8*b" If an expression is equivalent but not factorized enough, I would need to tell the student 'factorize some more'. When the student reaches the 'full' factorization of the expression, we would get the message 'good job!'.

So an answer like (2 + b*c**7) * b * 2 * (2 + b * c**7) (silly, I know) would return the 'factorize some more' message. And an answer like 2*(b*c^7 + 2)^2*b or (b*c^7 + 2)^2*b * 2 or 2 * b *(b*c^7 + 2)^2 would result in 'good job!'.

I've found how I can check if a solution is equivalent (bool(expr1 == expr2) seems to do the trick), and I know how to factor an expression, but I don't know if sage is capable of checking if an expression is 'factorized' enough or not...

Any ideas?

edit retag flag offensive close merge delete