6
$\begingroup$

There has been a similar question, but it doesn't solve my problem.

I have this input:

var = Exp[a] Exp[b]

And the output is

E^(a + b)

What I actually would like to have is just

var = E^(a)E^(b)

Is there a way to tell Mathematica to stop doing this simplification?

I tried with HoldForm, or Defer, but I actually need to operate on the variable, and those functions do not allow that. My idea would be to use SetSystemOptions, but I haven't found an option that relates to this simplification.

Thanks for any help.

$\endgroup$
  • 3
    $\begingroup$ Try using var = Inactivate[Exp[a] Exp[b], Exp], and see if that does what you want. Inactivate allows you to do symbolic manipulation with everything except for Exp. You can always re-activate Exp at the end by applying Activate to your expression. $\endgroup$ – march May 17 '16 at 19:51
  • $\begingroup$ @march @Andrea I've tried this and I can't get it to delay the re-simplification of Exp[a]Exp[b]. For example: expr = Exp[a (b + c) + d (f + g), then to get a list of the individual Exp terms: ts = Flatten[(# //. {Exp[Plus[a_, b_]] :> { Exp[a], Exp[b]}, Power[E, Plus[a_, b_, c___]] :> {Exp[First[a]], Exp[ Rest[a]]}}) & /@ {ExpandAll[expr]}], and then inactivate the Exp and Apply Times over the list: garb = Times @@ (ts /. Exp[a_] :> Inactive[Exp][a]), but notice that: Activate[garb] doesn't prevent the product of exponentials becoming and exponential of a sum. $\endgroup$ – Craig Carter May 17 '16 at 22:56
  • 1
    $\begingroup$ Would it be an option to replace Exp with exp? This will not be simplified, of course. You can do your calculations and replace agaun afterwards $\endgroup$ – Lukas May 18 '16 at 6:17
  • 1
    $\begingroup$ @CraigCarter. See this answer. Andrea: also see that answer. In addition, you can Inactivate Power, which might be necessary since your title seems to indicate that you want to do this with exponentials of arbitrary bases. $\endgroup$ – march May 18 '16 at 15:53
  • $\begingroup$ Thanks everybody. It seems like Inactivate does the job. Together with Craig's solution I should be able to first expand the exponentials, and then operate on them through Activate. $\endgroup$ – Andrea May 21 '16 at 16:00
1
$\begingroup$

Here I can give a not so intelligent method, for you should judge how many terms in the exponential term. Use the Rule to change back to the require form the code is

Exp[x b + y + z] /. {Exp[a_ + b_ + c_] :> Defer[Exp[a] Exp[b] Exp[c]]}

then get the result

(*Exp[b x] Exp[y] Exp[z]*)

I don't know how to made this Rule more intelligent. But sometimes it can works

Or use this command

Exp[x b + y + z] /. Exp[S : Plus[___]] :> HoldForm[Times] @@ Evaluate[Exp[List @@ S]]

But The result is

(*Times[E^(b x), E^y, E^z]*)

Thanks to previous answer. As a upgrade, you can use the methon in here, Firstly, set a Listable Attribute to the new symobl, Then give a HoldForm style Exp to this function, then use the rule in privious

SetAttributes[ExpT, Listable];
ExpT[x_] := HoldForm[Exp[x]]
Exp[x b + y + z] /. Exp[S : Plus[___]] :> Times @@ ExpT[List @@ S]

Then the result will be

(*Exp[b x] Exp[y] Exp[z]*)
$\endgroup$
  • $\begingroup$ See this answer. $\endgroup$ – march May 18 '16 at 15:54
  • $\begingroup$ I have upgrade my answer, please have a check. @march $\endgroup$ – 小菜220 May 19 '16 at 0:30

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.