$Version
(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)
Clear["Global`*"]
More generally, the truncated distribution is given by
tdist = TruncatedDistribution[{0, xmax}, ExponentialDistribution[λ]];
tdist
inherits the assumption on the parameter for ExponentialDistribution
and adds the assumption that xmax
is positive real.
dpa = DistributionParameterAssumptions[tdist]
(* λ > 0 && Im[xmax] == 0 && xmax > 0 *)
The PDF is
PDF[tdist, x]

Verifying the PDF
Assuming[dpa,
Integrate[PDF[tdist, x], {x, -Infinity, Infinity}]]
(* 1 *)
The moments are then
Moment[tdist, r]
(* (λ^-r (Gamma[1 + r] -
Gamma[1 + r, xmax λ]))/(1 - E^(-xmax λ)) *)
CentralMoment[tdist, r]
(* (1/(-1 + E^(xmax λ)))E^(-1 + (1 +
1/(-1 + E^(xmax λ))) xmax λ) λ^-r (Gamma[
1 + r, -1 + (xmax λ)/(-1 + E^(xmax λ))] -
Gamma[1 + r, -1 + (1 + 1/(-1 + E^(xmax λ))) xmax λ]) *)
For example,
Assuming[dpa,
#[tdist] & /@ {Mean, Moment[#, 1] &, Moment[#, 2] &,
Variance, CentralMoment[#, 2] &}]
