1
$\begingroup$

I have an expression $e^{x-a}(e^{bx}+c)$. I just want it multiplied throughout to get $e^{(b+1)x-a}+ce^{x-a}$. To achieve this I have tried Expand, Simplify, Collect (using pattern Exp[q_*x]). The best output I could get is

Expand[Exp[x-a]*(Exp[b*x]+c)]
(* Exp[-a+x+b*x]+c*Exp[-a+x] *)

I have tried Evaluate after this step to obtain proper exponent, but to no avail. How do I make it come with $e^{(b+1)x-a}$ in the first term?

$\endgroup$

2 Answers 2

5
$\begingroup$

Make a rule:

Expand[Exp[x - a]*(Exp[b*x] + c)] /. Exp[a_] :> Exp[Collect[a, x]]

enter image description here

See also:

$\endgroup$
2
$\begingroup$

MapAt with specified position:

tmp = Exp[x - a] (Exp[b x] + c) // Expand;
pos = Position[tmp, p_Plus /; ! FreeQ[p, x]];
MapAt[Collect[#, x] &, tmp, pos]    

c E^(-a + x) + E^(-a + (1 + b) x)

$\endgroup$
1
  • 1
    $\begingroup$ +1 Thanks a lot. It is nice to be aware of different ways of approaching a problem. $\endgroup$
    – Deep
    Nov 28, 2016 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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