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.

  • $\begingroup$ Would it be an acceptable solution to try to fix the package instead? Is it publicly and freely available? $\endgroup$
    – Szabolcs
    Feb 19, 2014 at 17:59
  • $\begingroup$ 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. $\endgroup$
    – Steve
    Feb 19, 2014 at 18:00
  • $\begingroup$ 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. $\endgroup$
    – Szabolcs
    Feb 19, 2014 at 18:01
  • $\begingroup$ 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. $\endgroup$
    – Richard
    Feb 19, 2014 at 18:16
  • $\begingroup$ Is this this package? $\endgroup$
    – Szabolcs
    Feb 19, 2014 at 18:56

1 Answer 1


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:

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.

  • $\begingroup$ 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! $\endgroup$
    – Richard
    Feb 19, 2014 at 22:13
  • $\begingroup$ @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. $\endgroup$ Feb 19, 2014 at 22:19

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.