STACK - expand/factor question

Re: STACK - expand/factor question

by Stephan Bach -
Number of replies: 0
Hi,
FacForm should accept \( (-2)\cdot (-x+1)\cdot (x+1)\), EqualComAss will not.
Of course you could use something like is (safe_op(ans1)="*") to determine if ans1 is a product and length(args(ans1)) to count the factors. But you would have to deal with many different cases if you want to implement this in your feedback variables (\(2\cdot \left(\frac 1 2\right) \cdot (2 x^2 - 2)\) is a product with 3 factors, too.).
Depending on what you want, it's probably easier and more robust to use EqualComAss to first check on \( 2\cdot (x-1)\cdot (x+1)\) and if false also on \( (-2)\cdot (-x+1)\cdot (x+1)\).
Stephan