# Mathematica rule to express exponentials as multiplication

I'm sorry if this has been asked before, but it is a very simple question and I would imagine it shouldn't be terribly hard for someone that knows to answer.

I'm essentially trying to tell mathematica to not simplify

Exp[x] Exp[y] -> Exp[x+y]


I am using an add on package which is having a hard time with some replacement rules. So, the question is, is it possible to force mathematica to express Exp[x] Exp[y] as is and not simplify it?

A secondary question, which should just be an extension of the first, I would like (Exp[x] Exp[y] )^2 to be replaced as Exp[x]^2 Exp[y]^2 not Exp[2x+2y]! Or even being left as is is ok.

• Would it be an acceptable solution to try to fix the package instead? Is it publicly and freely available? Feb 19, 2014 at 17:59
• Hold[Exp[x] Exp[y]] is supposed to solve this problem, but I've not had much success with Hold[] or HoldForm[] for some reason. Maybe others can address this. Feb 19, 2014 at 18:00
• I'm asking because I don't think it's possible to prevent this simplification without Holding the expression, as Steve suggests. But doing that might prevent the package from working with the expression. Feb 19, 2014 at 18:01
• Thanks for the suggestions. @Szabolcs you were right, the hold command restricts the package. The package is freely available, however, it interfaces in such a way to Singular which restricts this as a solution to the problem. Feb 19, 2014 at 18:16
• Is this this package? Feb 19, 2014 at 18:56

One possibility is to execute your entire code in some dynamic environment, where certain simplification rules are permanently or temporarily blocked. Here is the generic environment generator:

ClearAll[withBlockedSymbols];
withBlockedSymbols[syms : {__Symbol}] :=
Function[code, Block[syms, code], HoldAll];


We can now produce an environment generator specifically for Exp:

withBlockedExp = withBlockedSymbols[{Exp}]


Now, any code executed inside this wrapper, will not use the automatic simplification rules for Exp, which will be inert inside this wrapper. For example:

withBlockedExp[Hold[Evaluate[Exp[x] Exp[y]]]]

(* Hold[Exp[x] Exp[y]] *)

withBlockedExp[Hold[Evaluate[(Exp[x] Exp[y])^2]]]

(* Hold[Exp[x]^2 Exp[y]^2] *)


The only reason I needed to use Hold@Evaluate was to prevent the simplification happening after the execution exits withBlockedExp. Hold@Evaluate@expr allows us to preserve a final form of expr evaluated inside dynamic environment. If you have less trivial transformations, you will see the utility of withBlockedExp better, since you don't have to use Hold etc. for intermediate steps inside withBlockedExp.

• Thank you, this actually answered my original question, however, I was wrong in thinking it would solve the issue I'm having with the interface to my package! Feb 19, 2014 at 22:13
• @Richard Well, too bad then. But thanks for the accept. And you can always ask more questions (as separate questions), until your problem hopefully gets resolved. Feb 19, 2014 at 22:19