Logarithm of exponential
Since Log
is a multi-valued inverse function of Exp
, Mathematica doesn't evaluate Log[Exp[a]]
(or equivalently, Log[E^a]
). If you want to simplify these, you need to provide an assumption on the domain of a
, e.g.,
Simplify[Log[E^a], a ∈ Reals]
a
or
Simplify[Log[E^a], a > 0]
a
as suggested in the other answer. Another method is to use PowerExpand
:
PowerExpand[Log[E^a], Assumptions -> True]
a + 2 I π Floor[1/2 - Im[a]/(2 π)]
Addendum
As an aside, Log
behave exactly like ArcSin
here:
ArcSin[Sin[x]]
ArcSin[Sin[x]]
Including a domain restriction:
Simplify[ArcSin[Sin[x]], -Pi/2 < x < Pi/2]
x
For larger domains, Simplify
doesn't work:
Simplify[ArcSin[Sin[x]], 0 < x < 2 Pi]
ArcSin[Sin[x]]
Again, using PowerExpand
is useful:
p = PowerExpand[ArcSin[Sin[x]], Assumptions -> 0 < x < 2Pi];
p //TeXForm
$\begin{cases} \pi -x & \frac{\pi }{2}<x\leq \frac{3 \pi }{2} \\ x & x\leq \frac{\pi }{2} \\ x-2 \pi & \text{True} \end{cases}$
Visualization:
GraphicsColumn[{
Plot[ArcSin[Sin[x]], {x, 0, 2 Pi}],
Plot[p, {x, 0, 2 Pi}]
}]
The assumption a > 0
is needed when Simplify
is called:
Assuming[a > 0, Log[Exp[a]] // Simplify]
a