# Extracting coefficients from exponential function

I would like to extract the coefficients A,b0,b1,b2 from the following form:

A0 * Exp [b0 + b1*x + b2*x^2]

I am aware that the command Coefficient or CoefficientList would be able to do so for polynomials. Is there a way to do the same for the expression above?

forms = {A0*Exp[b0 + b1*x + b2*x^2],
Exp[b0 + b1*x + b2*x^2],
asd asdd Exp[b x^2]};

FirstCase[#, Exp[b__] a_. :> {a, CoefficientList[b, x]}, {}, {0}] & /@ forms // Column


{A0, {b0, b1, b2}}
{1, {b0, b1, b2}}
{asd asdd, {0, 0, b}}

Try to use the TreeForm function to visualize and the Part function to get the parameters. For example, here is your expression:

expr = A0*Exp[b0 + b1*x + b2*x^2]


Let us apply the TreeForm to it:

TreeForm[expr]


It returns the tree:

From this image you clearly see that the tree coordinate of A0 is {1}, and of, say, b0 is {2,2,1}. Indeed,

expr[]

(* A0  *)


and

expr[[2, 2, 1]]

(*  b0  *)


And the same you can apply to any other part of the expression.

Have fun!