Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Mathematica automatically simplifies Exp[a]Exp[b] to Exp[a+b]. The problem is now that I can't do this Exp[a]Exp[b]/.Exp[a]->c for example. How to solve this kind of problem?

In particular I want something like this to work Exp[x_+y_]//.Exp[x]Exp[y]/.Exp[some_pattern]->c.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

You may use HoldForm and HoldPattern for your purpose. Suppose you want to replace Exp[i_Integer] by c, then you can do the following:

replace[e_] := e /. Exp[x_ + y_] :> HoldForm[Exp[x] Exp[y]] /. HoldPattern@Exp[a_Integer] -> c

replace[Exp[1 + b] + Exp[2 + d]]
(* c exp(b) + c exp(d) *)
share|improve this answer
    
That's it. The only thing left is // FixedPoint[ReleaseHold, #] & at the end. –  swish Mar 1 '13 at 7:16
add comment

This answer is only applicable to easy examples!

You could try to find the inverse function and give the corresponding replacement rule:

Exp[a]Exp[b]/.a->Log[c]

But you have to be sure, that you don't miss special cases, when using the inverse function.

share|improve this answer
    
What if I got some pattern instead of a? Exp[A a]Exp[b]/.Exp[A _]->c –  swish Feb 28 '13 at 14:59
    
As I noted, this is only for easy examples. Maybe this could be interesting for you. Though it didn't work for me... –  Stefan Feb 28 '13 at 15:22
add comment

Perhaps you want something like

E^a E^b /. E^(a + b_.) :> c E^b
(* c E^b *)

which can be generalized to

E^(a A) E^b /. E^(a _ + b_.) :> c E^b
(* c E^b *)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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