# How to apply a continious substitution reduction of (-1 + 3 phi - 2 phi^3 - 6 phi^4 - 20 phi^6 + 6 phi^7 + 3 phi^8 + phi^9)//.{phi^3->1-phi^2}

$$(-1 + 3 phi - 2 phi^3 - 6 phi^4 - 20 phi^6 + 6 phi^7 + 3 phi^8 + phi^9)/.{phi^3->1-phi^2}$$,

that is not the problem. I am looking for a method that continues to apply this reduction until there are only linear and quadratic terms involving phi in one step. I have a lot of these reductions and some are a lot more complicated.

I have to apply this substitution, expand, then apply again for each reduction in powers of phi until I have no more than quadratic terms. So for example the phi^9 powers is eliminated by /.{phi^9->(1-phi^2)^3}, expand and continue.

• ReplaceRepeated (aka //.) will do this – KraZug Feb 17 '19 at 20:18
• PolynomialReduce[ is quite good for this purpose. – Daniel Lichtblau Feb 18 '19 at 13:54

expr /. {ToRules[
Reduce[{(-1 + 3 phi - 2 phi^3 - 6 phi^4 - 20 phi^6 + 6 phi^7 +
3 phi^8 + phi^9) == expr, phi^3 == 1 - phi^2}, expr]]}


{1 - 24 phi + 23 phi^2, 1 - 24 phi + 23 phi^2, 1 - 24 phi + 23 phi^2}

Reduce is used to find the simplest possible form for the expr under the given condition (phi^3 == 1 - phi^2), and expr /. {ToRules[...]} is used to isolate the expression of interest from Reduce's result.

Note that this returns a list of results: any result here should be a valid form of the expression under some condition. In this case, they're all the same, but they may not always be. You can grab one with First or you can keep them all (or use DeleteDuplicates or so on).

This

Simplify[-1+3 phi-2 phi^3-6 phi^4-20 phi^6+6 phi^7+3 phi^8+phi^9, phi^3 == 1-phi^2]


gives this

(*1 - 24*phi + 23*phi^2*)


Several methods can be used. The simplest use only polynomial operations. The code

p = -1 + 3 phi - 2 phi^3 - 6 phi^4 - 20 phi^6 + 6 phi^7 + 3 phi^8 + phi^9;
q = phi^3 - 1 + phi^2;  r = 1 - 24*phi + 23*phi^2;   (* r is the result *)
{r == PolynomialReduce[p, q, phi][], r == PolynomialRemainder[p, q, phi]}


returns {True, True}.