1
$\begingroup$

I have a very complicated, long (thousands of terms) expression that boils down to a form of

expr = a1 Exp[b1] + a2 Exp[b2] + a3 Exp[b3]

Note that all a and b are huge symbolic expressions but the expression is expanded that way.

Now I would like to get a list with b1, b2, b3. All I can do is

Collect[expr, E^_]

but that does not give me a list.

$\endgroup$
1
$\begingroup$

You can use Cases:

Cases[expr, Exp[p_] :> p, All]

{b1, b2, b3}

Alternatively, you can use Exponent after changing the head of expr to List:

Exponent[List @@ expr, E]

{b1, b2, b3}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.