2
$\begingroup$

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]
$\endgroup$

1 Answer 1

4
$\begingroup$

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

Pi Log[Pi] /. {x_ Log[y_] -> Hold[Log[y^x]]}
$\endgroup$
1
  • 3
    $\begingroup$ If only appearance is important you could also use HoldForm. $\endgroup$
    – Mr.Wizard
    Mar 24, 2013 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.