Is there a function similar to PowerExpand
which expand exponentials? This would, for example, take
Exp[5(a + b)]
and return
Exp[5a]*Exp[5b].
The desired representation will automatically simplify when evaluated
Exp[5 a]*Exp[5 b]
To get and maintain the desired factored form requires any of several methods of holding the evaluation. As suggested by DumpsterDoofus, one approach is to use an unassigned operator. A slightly modified version of this approach:
expr = Exp[5 (a + b)];
f = CenterDot @@ (Exp /@ List @@
(Log[#] // PowerExpand // Expand)) &;
invf = # /. CenterDot -> Times &;
expr2 = expr // f
Using the inverse
expr2 // invf
% // Simplify
This could also be a case where the version-10 command Inactive
may be useful. Before inserting an inactive version of Exp
, I also split up exponents consisting of sums by temporarily replacing powers of E
with a function exp
that only implements the desired multiplicative property. To cast these replacements in the form of a function expExpand
, we have to make sure the expression expr
provided as its argument is not touched in any way. That's what the HoldAllComplete
attribute is for:
ClearAll[expExpand, exp];
exp[x_Plus] := Times @@ exp /@ x
SetAttributes[expExpand, HoldAllComplete];
expExpand[expr_] :=
ReleaseHold[Hold[expr] /. E^x_ :> exp[x]] /. exp -> Inactive[Exp]
expExpand[1/2 (E^(5 a) E^(7 b + 8 c + z)) + 1/(1 + E^(4 a))]
The expression is now displayed in the desired form, with the inactive Exp
in a different color. You can then do Activate
to get the expression to be returned to its canonical form if desired.
Times is converted internally to power because Times is not a canonical form. I would also suggest the following:
r=Dot @@ Exp /@ Level[(Exp[5 (a + b + c)] // ExpandAll), {2}]
(*E^(5 a).E^(5 b).E^(5 c)*)
if you want to bring back the result,then:
Times @@ r
(*E^(5 a + 5 b + 5 c)*)
Exp[5 a + 6 b] /. Exp[Plus[a_, b_]] :> CenterDot @@ {Exp[a], Exp[b]}
, which outputs $e^{5 a}\cdot e^{6 b}$, is one simple way to go. Making it correctly work in all cases might take some tinkering, but it's a step in the right direction. $\endgroup$