|   | 1 |  initial version  | 
Try y.collect_common_factors().  This gives the output you want.
You could also use factor(y,x^2) if you know upfront that you want to factor out $x^2$.
|   | 2 |  improved formatting  | 
Try Try:
y.collect_common_factors()y.collect_common_factors().
This gives the output you want.
You could also use factor(y,x^2) if you know upfront that you want to factor out $x^2$.
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.