1
$\begingroup$

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.

$\endgroup$

3 Answers 3

2
$\begingroup$

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) *)
$\endgroup$
1
  • $\begingroup$ That's it. The only thing left is // FixedPoint[ReleaseHold, #] & at the end. $\endgroup$
    – swish
    Commented Mar 1, 2013 at 7:16
0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ What if I got some pattern instead of a? Exp[A a]Exp[b]/.Exp[A _]->c $\endgroup$
    – swish
    Commented Feb 28, 2013 at 14:59
  • $\begingroup$ As I noted, this is only for easy examples. Maybe this could be interesting for you. Though it didn't work for me... $\endgroup$
    – Stefan
    Commented Feb 28, 2013 at 15:22
0
$\begingroup$

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 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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