16
$\begingroup$

I want to be able to expand $\log(x^n e^x) = n \log(x) +x$:

FullSimplify[Log[x^n Exp[x]], x > 0 && Element[n, Integers] && n > 1]

yields

Log[E^x x^n]

whereas

-1 +FullSimplify[Log[x^n Exp[x]] + 1,  x > 0 && Element[n, Integers] && n > 1]

yields

x + n Log[x]

what gives? Maybe it recognizes that I want to do arithmetic outside the log, so it then simplifies the expression; if that's the case, how can I force it to do that without hacking it by adding and subtracting 1?

thanks!

$\endgroup$
1
  • 2
    $\begingroup$ Can use PowerExpand with assumptions. The use of assumptions, while not really needed in your example, is good practice for cases where branch cuts might otherwise inadvertently be crossed. PowerExpand[Log[x^n Exp[x]], Assumptions -> x > 0 && Element[n, Integers] && n > 1] Out[1]= x + n Log[x] $\endgroup$ Feb 24, 2013 at 21:16

1 Answer 1

18
$\begingroup$

Maybe:

FullSimplify[PowerExpand@Log[x^n Exp[x]], 
 x > 0 && Element[n, Integers] && n > 1]
x + n Log[x]
$\endgroup$

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.