# Decomposing a product of "monomials" to list

Definition of the problem

I wish to solve equations of the form

expression = (x^2 - r)  (x^2 r - 1) (r^(3/2) + x) (x r^(3/2) +
1) (x r^(1/3) - 1);
expression ==0


for the variable x. Solve can do the job in this simple case but in more complicated cases where the product is much longer it becomes difficult. However, in the more complicated cases the structure of the equation as a product of "monomials" remains, and I wish to make use of it. I want to decompose the product to a list of "monomials" of the form

{ (x^2 - r),  (x^2 r - 1), (r^(3/2) + x), (x r^(3/2) + 1), (x r^(1/3) - 1) }


and to use Solve for each element separately. In the end, each solution must be checked to be a true solution of the full equation. I think this is a more efficient way to solve my problem, but other suggestions are appreciated.

My partial solution

An algorithm based on string manipulation is the following

str = TextString[expression];
str2 = StringTrim[str, {"Times[", "]"}];
str3 = StringJoin["{", str2, "}"];
termList = ToExpression[str3]


Applying to the expression above gives the output:

{r^1.5+x,r^0.333333 x-1,r^1.5 x+1,x^2-r,r x^2-1}


It works, except the problem that TextString changed fractions such as 3/2 to 1.5 and 1/3 to 0.333.

Other solutions or completing my own solution will be very appreciated. Thanks!

Appendix: example of a more complicated equation

Solving the equation

a1 a2 (1-r)^3 (1-r/a1^4) (1-r/a1^2)^2 (1-a1^2 r)^2 (1-a1^4 r) (1-r/a2^4) (1-r/a2^2)^2 (1-a2^2 r)^2 (1-a2^4 r) (1-r/(a1 a2^3)) (1-(a1 r)/a2^3) (1-r/(a1^2 a2^2)) (1-(a1^2 r)/a2^2) (1-r/(a1^3 a2)) (1-r/(a1 a2))^2 (1-(a1 r)/a2)^2 (1-(a1^3 r)/a2) (1-(a2 r)/a1^3) (1-(a2 r)/a1)^2 (1-a1 a2 r)^2 (1-a1^3 a2 r) (1-(a2^2 r)/a1^2) (1-a1^2 a2^2 r) (1-(a2^3 r)/a1) (1-a1 a2^3 r)==0


for the variable a1, as a function of r, a2.

## 1 Answer

expression1 = (x^2 - r)  (x^2 r - 1) (r^(3/2) + x) (x r^(3/2) +  1) (x r^(1/3) - 1);

list1 = List @@ expression1


{r^(3/2) + x, -1 + r^(1/3) x, 1 + r^(3/2) x, -r + x^2, -1 + r x^2}

If you want to keep the order of terms:

ReleaseHold @ List @@@
HoldForm[(x^2 - r)  (x^2 r - 1) (r^(3/2) + x) (x r^(3/2) +  1) (x r^(1/3) - 1)]


{x^2-r, x^2 r-1, r^(3/2)+x, x r^(3/2)+1, x r^(1/3)-1}

Alternatively,

Activate[List @@
Inactivate[(x^2 - r)  (x^2 r - 1) (r^(3/2) + x) (x r^(3/2) + 1) (x r^(1/3) - 1)]]


{-r + x^2, -1 + r x^2, r^(3/2) + x, 1 + r^(3/2) x, -1 + r^(1/3) x}

Solve[# == 0, x] & /@ %


{{{x -> -Sqrt[r]}, {x -> Sqrt[r]}},
{{x -> -(1/Sqrt[r])}, {x -> 1/Sqrt[r]}},
{{x -> -r^(3/2)}},
{{x -> -(1/r^(3/2))}}, {{x -> 1/r^(1/3)}}}