Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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].

Entering:

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

Returns:

Pi Log[Pi]

instead of:

Log[Pi^Pi]
share|improve this question

1 Answer 1

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
3  
If only appearance is important you could also use HoldForm. –  Mr.Wizard Mar 24 '13 at 15:27

Your Answer

 
discard

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.