Group Abstract Group Abstract

Message Boards Message Boards

0
|
34 Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

How do you expand Exp[a+b] to Exp[a] Exp[b] ?

Posted 1 day ago

Hello

To achieve this result all my attemps with Simplify, PowerExpand failed :

PowerExpand[Exp[a+b]]
Simplify[Exp[a+b],Assumptions->{a,b} \[Element] Reals]

Using patterns I cannot get a transformation with

Exp[a + b] /. Power[E, Plus[a_ + b_] ] -> Exp[a] Exp[b]

Thanks

POSTED BY: Jan Potocki
5 Replies
Posted 13 hours ago

Just a couple extra comments:

(1) In your replacement rule, you are duplicating the Plus. So, using M Rogers suggestion, the following

Exp[a + b] /. Power[E, Plus[a_ + b_]] :> HoldForm[E^a*E^b]

can be simplified to

Exp[a + b] /. Power[E, a_ + b_] :> HoldForm[E^a*E^b]

or

Exp[a + b] /. Power[E, Plus[a_, b_]] :> HoldForm[E^a*E^b]

(2) You said you "want to do further calculations with the powers of variables separated ... using Part afterwards". If this is your approach, you can almost certainly do those calculations directly on your original expression, E^(a+b). For example, while you certainly can do things like this:

HoldForm[E^a*E^b][[1, 1]]
(* E^a *)

you can also do things like this with your original:

Exp[a + b][[2, 1]]
(* a *)

Extract[Exp[a + b], {{1}, {2, 1}}]
(* {E, a} *)

(3) If it's relevant to your situation, you need to be careful about other automatic transformations that are done on expressions independently of the evaluation process. Specifically, things are put into a canonical form which often relies on sort order. For example:

Exp[b + a] /. Power[E, Plus[a_, b_]] :> HoldForm[E^a*E^b]
(* HoldForm[E^a*E^b] *)

Notice that the order of the exponents has been reversed (sorted). This is because Exp[b + a] is immediately transformed to E^(a + b) before the replacement rule is evaluated. In general, one must proceed very cautiously if one wants to manipulate expressions structurally as part of one's own evaluation process. Generally it's safer to capture one's semantics explicitly rather than fight with WL's expression handling.

POSTED BY: Eric Rimbey
Posted 14 hours ago

Yes Michael I want to do further calculations with the powers of variables separated. With Defer, HoldForm , Inactivate as suggested and using Part afterwards I can proceed further.

Thanks to Michael and Henryk

POSTED BY: Updating Name

As Henrik has said, Times[] and Power[] automatically combine powers with like bases. The principal reason for fighting against the flow is to format output, I suppose. If it's not and you want to do some algebraic computation with the products of powers separated, it might be good to say what that problem is. It is rather difficult to get Times[] and Power[] to behave differently.

There are two or three approaches to formatting output when another form than the standard Mathematica output is desired, HoldForm[], Defer[], and boxes (with various tools like MakeBoxes[], ToBoxes[], RawBoxes[] and DisplayForm[]). Boxes are the most complicated, and I'll skip that approach. Here are variations on Henrik's approach:

res1 = Exp[a + b] /. Power[E, Plus[a_ + b_]] :> Defer[E^a*E^b]
% // InputForm
(*  E^a E^b  *)
(*  Defer[E^a*E^b]  *)

res2 = Exp[a + b] /. Power[E, Plus[a_ + b_]] :> HoldForm[E^a*E^b]
% // InputForm
(*  E^a E^b  *)
(*  HoldForm[E^a*E^b]  *)

Note that the HoldForm[] is present even if you copy and paste the output. The Defer[] is part of the result res1, but it is stripped if you copy the output, which is convenient for interacting with a notebook. If you use either variable res1 or res2 in further computation, use First[res1] or First[res2] to remove the head. The powers will combine, of course, but look at what you get if you compute res1^2 or res2 / E^a without First[].

POSTED BY: Michael Rogers

This factorizes it, in a way:

In[13]:= E^(a + b) // ExpToTrig // TrigExpand // Factor

Out[13]= (Cosh[a] + Sinh[a]) (Cosh[b] + Sinh[b])
POSTED BY: Gianluca Gorni

The pattern replacement does work - but the product Exp[a] Exp[b] is immediately simplified back to Exp[a+b], as you can see e.g. like so:

TracePrint[Exp[a + b] /. Power[E, Plus[a_ + b_]] :> Exp[a] Exp[b], Times[__]]

Does instead something like this work for you?

Exp[a + b] /. Power[E, Plus[a_ + b_]] :> Inactivate[Exp[a] Exp[b], Times]
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard