Entropy of a probability distribution (symbolically)
Timing can be improved with simplification with assumptions:
exp = Expand[
FullSimplify[-Log[PDF[NormalDistribution[m, s], x]],
Assumptions -> {{m, x, s} ∈ Reals, s > 0}]];
Integrate[
exp PDF[NormalDistribution[m, s], x], {x, -∞, ∞},
Assumptions -> {{m, x, s} ∈ Reals, s > 0}] // Timing
yields:
{2.09375, 1/2 (1 + Log[2 π s^2])}
See comment by @gwr below.
Expectation
yields better performance on simplified expression (as 'expected')...too bad I didn't think to use it :(
Let $X \sim N(\mu, \sigma^2)$ with pdf $f(x)$:
Then, the way we solve this in Chapter 1 of Mathematical Statistics with Mathematica (free download of book available here) is to find $E[-log(f)]$:
... which uses the mathStatica Expect
function, and takes about 6 seconds to evaluate on my Mac in 11.2.
I was surprised at the OP's suggestion that:
Expectation[Log@PDF[NormalDistribution[m, s], x],
Distributed[x, NormalDistribution[m, s]]] // AbsoluteTiming
... does not evaluate. When I tried it, it does evaluate, but it takes about 160 seconds to return the equivalent:
{161.93, 1/2 (-1 - Log[2 [Pi] s^2])}
... on the same computer in v11.1.1 and about 80 seconds under 11.2.