how to factorize an expression with constant variables ?
Hello, I would like to factorize an expression with sage that contains constant variables (i.e. parameters), but I cannot figure out how to do that.
Here is an example : x
, y
are variables and A
is a parameter
var('A x y')
f = A*x + x + A^2*exp(y) + y
print (f.factor())
Sage returns A^2*e^y + A*x + x + y
.
Instead, I would like that sage returns (A+1)*x + (A^2+1)*exp(y)
.
How to do that ? Thank you