Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to do the reverse of PowerExpand and convert 2*Log[x+y] to Log[(x+y)^2]. The rule:

 t_ Log[x_] -> Log[x^t]

works for a Log[y], a Log[Pi], Pi Log[a], 2 Log[a], a Log[2] but not for 2 Log[Pi], Pi Log[2], Pi Log[EulerGamma].


Pi Log[Pi] /. Pi Log[Pi] -> Log[Pi^Pi]


Pi Log[Pi]

instead of:

share|improve this question
up vote 4 down vote accepted

I think it's doing it and then simplifying back. Try :

Pi Log[Pi] /. {x_ Log[y_] -> Hold[Log[y^x]]}
share|improve this answer
If only appearance is important you could also use HoldForm. – Mr.Wizard Mar 24 '13 at 15:27

Your Answer


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.