# Simplifying expression on power [closed]

I want to understand the behavior of Mathematica for the following code.

E^(-m0 + e1/2 + 1/2 (-e1 - e2) + e2/ 2 + (e1 + e2)/2) /. {Power[E, a___] -> Power[E, Expand[a]]}


I expected to see

E^(-m0 + e1/2 + e2/2)


E^(-m0 + e1/2 + 1/2 (-e1 - e2) + e2/ 2 + (e1 + e2)/2)


Why is it? If there is any suggestion, could you reply to me? Thanks a lot.

-

## closed as off-topic by Sjoerd C. de Vries, rasher, Kuba, m_goldberg, ArtesApr 29 '14 at 0:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Sjoerd C. de Vries, rasher, Kuba, m_goldberg, Artes
If this question can be reworded to fit the rules in the help center, please edit the question.

You need to use RuleDelayed and it will work the way you expect –  gpap Apr 28 '14 at 11:07
I will add to the above that RuleDelayed can be invoked by replacing -> with :>. –  Saran Apr 28 '14 at 11:20
It works! Thanks a lot. –  Joonho Kim Apr 28 '14 at 11:35
I will add to the above that Rule doesn't work here because the righthand side is evaluated before the replacement takes place. The rhs Expand[a] results in just a. –  Sjoerd C. de Vries Apr 28 '14 at 11:38