Question: Expand and factor

Hello everyone !

 

I would like to know if there's a way to get simplified expressions for multivariables expressions...

 

for a simple example :

 

expand((a+b)^2) returns a²+b²+2ab

how could I get (a+b)^2 from a²+b²+2ab ?

 

for a more complicated example :

factor([2*x^3 - 6*x*y*z + 2*y^3 + 2*z^3])

returns :


        [2 (x + y + z) (x²  - x y - x z + y²  - y z + z²)]

but since :

2*(x²  - x y - x z + y²  - y z + z²) = (x - y)^2 + (y - z)^2 + (z - x)^2

 

is there a way to get that kind of simplification ?

 

thank you for your time

 

Please Wait...