Atlee Jackson, problem 1.13

a)

Clear[f, λ, a]
f[x_] = (λ/Sqrt[Pi]) E^(-λ^2 (x  - a)^2)

Check normalization

Simplify[
Integrate[f[x], {x, -Infinity, Infinity}],
λ > 0]

average of X

Clear[avgX]
avgX = Simplify[Integrate[x f[x], {x, -Infinity, Infinity}], λ > 0]

average of X^2

Clear[avgXsq]
avgXsq = Simplify[
Integrate[x^2 f[x], {x, -Infinity, Infinity}],
λ > 0]

Variance of X

Clear[varX]
varX = avgXsq - avgX^2

h = -Simplify[
Integrate[f[x] 
(*Log[f[x]]*)
(Log[λ/Sqrt[Pi]] -λ^2 (x  - a)^2)
, {x, -Infinity, Infinity}],
λ > 0]

Clear[varX]
h /. λ -> Sqrt[1/varX/2]  // FullSimplify

So the final answer is H = (1/2) (log(2 π Δ X)+1)

b)

Clear[f, c]
f[x_] = c E^( -c x)

Check normalization:

Simplify[
Integrate[ f[x], {x, 0, Infinity}],
c > 0]

average

Clear[avgX]
avgX = Simplify[
Integrate[ x f[x], {x, 0, Infinity}],
c > 0]

Clear[avgXsq]
avgXsq = Simplify[
Integrate[ x^2 f[x], {x, 0, Infinity}],
c > 0]

variance

Clear[varX]
varX = avgXsq - avgX^2

uncertainty

h = -Simplify[
Integrate[f[x] 
(*Log[f[x]]*)
(Log[c] -c x)
, {x, 0, Infinity}],
c > 0]

h /. c -> 1/Sqrt[Δ X] // Simplify

So the final answer is H =  (1/2) (log( Δ X)+2)

With a helper function to do the various bits of the calculation without the manual repetition

Clear[calc, λ, a]

(* http://mathematica.stackexchange.com/questions/16945/why-am-i-getting-trues-when-passing-pure-functions-as-arguments-to-module#comment50098_16945 *)
calc[f_, logF_, r_, a_] := (* SetDelayed *)

Module[{integrationRangeParam, avgX, avgXsq, varX, h},

avgX = Simplify[
Integrate[x f[x], {x,Sequence@@r}],
a] ;

avgXsq = Simplify[
Integrate[x^2 f[x], {x,Sequence@@r}],
a] ;

varX = avgXsq - avgX^2 ;

h = Simplify[
- Integrate[ f[x] logF[x], {x,Sequence@@r}],
a] ;

{ avgX, avgXsq, varX, h }
]

Clear[parta, partb]
parta = calc[ 
Function[(λ/Sqrt[Pi]) E^(-λ^2 (#  - a)^2)],
Function[Log[(λ/Sqrt[Pi])] -λ^2 (#  - a)^2],
{-Infinity, Infinity},
λ > 0
] 
partb = calc[ 
Function[c  E^(- c# )],
Function[Log[c] -c # ],
{0, Infinity},
c > 0
]