I have a polynomial with the coefficients of {a1, b1, b2}
x = 1/8 (a1^4 E^(4 I τ ω) - 2 a1^2 E^( 2 I τ ω) (b2 Sqrt[1 - t] + b1 Sqrt[t])^2 + (b2 Sqrt[ 1 - t] + b1 Sqrt[t])^4);
After expanding, it is :
Expand[x]
b2^4/8 - 1/4 a1^2 b2^2 E^(2 I τ ω) + 1/8 a1^4 E^(4 I τ ω) + 1/2 b1 b2^3 Sqrt[1 - t] Sqrt[t] - 1/2 a1^2 b1 b2 E^(2 I τ ω) Sqrt[1 - t] Sqrt[t] + 3/4 b1^2 b2^2 t - (b2^4 t)/4 - 1/4 a1^2 b1^2 E^(2 I τ ω) t + 1/4 a1^2 b2^2 E^(2 I τ ω) t + 1/2 b1^3 b2 Sqrt[1 - t] t^(3/2) - 1/2 b1 b2^3 Sqrt[1 - t] t^(3/2) + ( b1^4 t^2)/8 - 3/4 b1^2 b2^2 t^2 + (b2^4 t^2)/8
There are two problems :
The terms
1/2 b1 b2^3 Sqrt[1 - t] Sqrt[t]
and-(1/2) b1 b2^3 Sqrt[1 - t] t^(3/2)
have the same coefficient b1 b2^3 , but they donot combine automatically. I need all the terms with the same coefficient in {a1, b1, b2} be combined. e.g.,1/2 b1 b2^3 Sqrt[1 - t] Sqrt[t] - 1/2 b1 b2^3 Sqrt[1 - t] t^(3/2) = 1/2 b1 b2^3 (1 - t)^(3/2) Sqrt[t]
I need the polynomial be reordered in a descending order of the variables {a1, b1, b2}, as shown below, but this is done by hand. I hope how to do so automatically by Mathematica.
1/8 a1^4 E^(4 I τ ω) - 1/4 a1^2 b1^2 E^(2 I τ ω) t - 1/2 a1^2 b1 b2 E^(2 I τ ω) Sqrt[1 - t] Sqrt[t] - 1/4 a1^2 b2^2 E^(2 I τ ω) + 1/4 a1^2 b2^2 E^(2 I τ ω) t + (b1^4 t^2)/8 + 1/2 b1^3 b2 Sqrt[1 - t] t^(3/2) + 3/4 b1^2 b2^2 t - 3/4 b1^2 b2^2 t^2 + 1/2 b1 b2^3 Sqrt[1 - t] Sqrt[t] - 1/2 b1 b2^3 Sqrt[1 - t] t^(3/2) + b2^4/8 - (b2^4 t)/4 + (b2^4 t^2)/8
After reordering in a descending order, and combining all the terms with the same coefficient, I achieve the final result of
1/8 a1^4 E^(4 I τ ω) - 1/4 a1^2 b1^2 E^(2 I τ ω) t - 1/2 a1^2 b1 b2 E^(2 I τ ω) Sqrt[1 - t] Sqrt[t] +1/4 a1^2 2^2 E^(2 I τ ω) (-1 + t) + (b1^4 t^2)/8 + 1/2 b1^3 b2 Sqrt[1 - t] t^(3/2) + -(3/4) b1^2 b2^2 (-1 + t) t + 1/2 b1 b2^3 (1 - t)^(3/2) Sqrt[t] + 1/8 b2^4 (-1 + t)^2
Or in figure format:
I can do this work manually in this example with only 14 terms, but in my next step I need to process a polynomial with more than 30 terms. Doing this reordering and combining work automatically is very necessary.
I have checked the previous questions and answers on stackexchange, but my problems can not be solved. Thank you very much if you can help me!