As I noted in the commentary, such “partial factorizations” are not unique (for example, x**2 + 5*x + 7equal to (x + 2)*(x + 3) + 1and (x + 1)*(x + 4) + 3), and as soon as you understand what is happening, it’s not difficult to come up with examples of your own).
, , , , . , , :
>>> print(A.subs(phi, x + phi_0).factor().subs(x, phi - phi_0))
(phi - phi_0)**2 - 8
x = phi - phi_0 (SymPy , phi - phi_0 x, , phi x - phi_0, ). , , . , , , phi - phi_0 - , .
, , , , , . http://docs.sympy.org/latest/tutorial/manipulation.html, . Expr. , , as_*.