# Coefficient of function different than polynomial

My question arise from the problem that Mathematica can't solve the equation

$$\text{Solve}\left[e^{a-x} (0.0299584 a+0.1 b-0.0299584 x-0.152913)-0.9 a+0.9 b+0.9 x+0.18=0.0498614 e^{-x} \left(e^a ((0.09 a-0.378) a+b (0.600833 x+0.660917)-0.54075 x-0.107925)+5.4075 \left(3.00417 e^x (-1. a+b+x+0.2)+a-b+0.8\right)\right)\land (0.1 b-0.09) e^{a-x}+0.9 (-a+b+x+0.1)=\frac{1}{2} e^{-x-2.2} \left(0.9 e^a \left(0.09 \left(a^2-4.2 a+5.41\right)-6.00833 (-0.1 (a-1) b+0.09 a-0.19)\right)+5.4075 \left(e^{x+1.1} (-a+b+x+0.1)+0.9 (a-b+0.8)\right)\right),\{a,b\}\right]$$

I was thinking about extracting coefficients of $\exp{x}$ of the LHS of the first equation and then compare it with the same coefficient on the RHS. Then perform the same operation, but with the coefficient of $x\exp{x}$ and so on? How to do it?

• Welcome to Mathematica.SE. You will attract more attention to your question if edited the LaTeX expression into plain text Mathematica code that people can copy and paste into Mathematica and experiment with. Apr 7, 2014 at 15:49

Not a perfect solution, but you could try Expand and Collect. Example:

lhs = a x E^(x - a) + Exp[x] (x - 1)^2 + 5/Exp[-x];
Collect[Expand[lhs], {x^2*Exp[x], x*Exp[x], Exp[x]}]


output

6 E^x + E^x (-2 + a E^-a) x + E^x x^2


note:

• the order of the second argument of Collect
• different input style of E^ and Exp[] doesn't matter here, but sometimes exact input form matters for Collect (check the documentation of Collect)
• Thank you very much for your help
– user13551
Apr 8, 2014 at 18:42