Re: Simplifying the exponents
- To: mathgroup at smc.vnet.net
- Subject: [mg80067] Re: Simplifying the exponents
- From: dimitris <dimmechan at yahoo.com>
- Date: Sat, 11 Aug 2007 02:22:35 -0400 (EDT)
- References: <f9gv3l$b5e$1@smc.vnet.net>
On 10 , 09:03, "Jung-Tsung Shen" <jus... at gmail.com> wrote: > Hello, I would like to ask a question which I haven't been able to > find a solution that does not need human intervening. > > I would like to simplify the following expression > > Exp[I (q1 y1 + q2 y2 + q3 y3) - I (qp1 y1 + qp2 y2 + qp3 y3)] > > according to y1, y2, and y3 so it would look like > > Exp[I (q1-qp1) y1+ I (q2-qp2) y2 + I (q3-qp3) y3], or > > Exp[I (q1-qp1) y1] * Exp[I (q2-qp2) y2] * Exp[I (q3-qp3) y3] > > How could I achieve this in an efficient way? > > Thanks. > > JT Hello. Say, ox1 is your expression In[83]:= ox1 = Exp[I*(q1*y1 + q2*y2 + q3*y3) - I*(qp1*y1 + qp2*y2 + qp3*y3)] Out[83]= E^(I*(q1*y1 + q2*y2 + q3*y3) - I*(qp1*y1 + qp2*y2 + qp3*y3)) Then the first you request, can be taken by In[87]:= ox2 = ox1 /. E^(a_) :> E^(Collect[a, {y1, y2, y3}] /. (b_)*(c_) :> Simplify[b]*c) Out[87]= E^(I*(q1 - qp1)*y1 + I*(q2 - qp2)*y2 + I*(q3 - qp3)*y3) For the second request, you must enter HoldForm in the "game" as follows In[93]:= ox3=(HoldForm[#1]*HoldForm[#2]*HoldForm[#3] & ) @@ (ox2 /. E^(a_) :> (E^#1 & ) /@ List @@ a) Out[93]= HoldForm[E^(I*(q1 - qp1)*y1)]*HoldForm[E^(I*(q2 - qp2)*y2)]*HoldForm[E^(I*(q3 - qp3)*y3)] However, In[95]:= ReleaseHold[ox3] Out[95]= E^(I*(q1 - qp1)*y1 + I*(q2 - qp2)*y2 + I*(q3 - qp3)*y3) Cheers Dimitris