Collecting exponentials

Suppose you have expression that is a summation of products of exponentials, how to simplify it by collecting exponentials inside products? See example what I need:

$$2^{\frac{x}{2}+5}*3^{\frac{1}{2}-2 x}*5^{x-2}+4^{3 x+2}*7^{3-2 x}*11^{4 x+\frac{1}{2}}=\\\frac{\left(32 \sqrt{3}\right)}{25} \left(\frac{5 \sqrt{2}}{9}\right)^x+5488 \sqrt{11} \left(\frac{937024}{49}\right)^x$$

2^(5+x/2)*3^(1/2-2 x)*5^(-2+x)+4^(2+3 x)*7^(3-2 x)*11^(1/2+4 x)==(32 Sqrt[3])/25 ((5 Sqrt[2])/9)^x+5488 Sqrt[11] (937024/49)^x


The output could be in the form: $$\{\{\frac{\left(32 \sqrt{3}\right)}{25},\frac{5 \sqrt{2}}{9}\},\{5488 \sqrt{11},\frac{937024}{49}\}\}$$

because I can recover the result like this:

Total[#[[1]] #[[2]]^x&/@{{(32 Sqrt[3])/25 ,(5 Sqrt[2])/9},{5488 Sqrt[11] ,937024/49}}]==(32 Sqrt[3])/25 ((5 Sqrt[2])/9)^x+5488 Sqrt[11] (937024/49)^x

• The starting expression is always an expanded sum of terms, each term being a product of exponentials as shown? Jun 26 at 13:32
• Yes, just sum of products of exponentials and nothing else. And exponential are just in one variable x. Jun 26 at 13:36

Use Log to convert each term to a polynomial:

To handle cases where the sum is not expanded (e.g. 2(t1 + t2) where t1 and t2 are exponential terms) and the expression may be a single term:

Simplify@Exp@CoefficientList[
Log /@ Replace[
Expand@expr,
{e_Plus :> List @@ e, e_ :> {e}}] //
PowerExpand, x]


Original case: The input is always an expanded sum of terms, each term being a product of exponentials shown in the OP.

expr = 2^(5 + x/2)*3^(1/2 - 2 x)*5^(-2 + x) +
4^(2 + 3 x)*7^(3 - 2 x)*11^(1/2 + 4 x);

Simplify@Exp@CoefficientList[Log /@ List @@ expr // PowerExpand, x]

(*  {{(32 Sqrt[3])/25, (5 Sqrt[2])/9}, {5488 Sqrt[11], 937024/49}}  *)


$$\left\{\frac {32 \sqrt {3}} {25}, \frac {5 \sqrt {2}} {9} \right\}, \left\{5488 \sqrt {11}, \frac {937024} {49} \right\}$$

Response to comment: To handle cases that are not sums but a single term (the expense of Expand@expr is probably very little if the term is already expanded, so I recommend the solution I put at the top).

Simplify@Exp@CoefficientList[
Log /@ Replace[
expr,
{e_Plus :> List @@ e, e_ :> {e}}] //
PowerExpand, x]

• Great trick with using logarithm! I will test it whether it works in all circumstances. Jun 26 at 13:39
• Sometimes the Exp return like E^(2 (Log[3]+Log[17])) for expr=2^(2+4 x) 51^(2 x) 77^x+3^x. And it does not work for expr=3^(x+5) or expr=2*3^(x+5) which are already in the required form, but I can handle all of that. Jun 26 at 14:23
• @azerbajdzan Try Simplify[Exp@CoefficientList[...]]. I guess it worked on the test example because there are certain autosimplify rules Mathematica applies right away. -- And if expr is not a sum, i.e., just a single term, then List @@ expr won't work properly. Jun 26 at 14:27
• There is another problem. For examples expr=2^s+3^s+51^(2 s)-3^(2 s) 289^s produces {{1, 2}, {1, 3}, {1, 2601}, {-1, 2601}} but the desired result should be {{1, 2}, {1, 3}}. It is because of "hidden" zero: 51^(2 s)-3^(2 s) 289^s==0. Jun 26 at 15:47
• @azerbajdzan This is the sort of issue I had in mind when I asked the question in the comment. The procedure might fail if the input is not prepared according to the requirements. You need to pass a sum of terms in the form you want process. In this case Simplify[expr]` seems to fix the input. Jun 26 at 15:54