% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/residual_entropy.R
\name{shannon_entropy}
\alias{shannon_entropy}
\title{Shannon Differential Entropy}
\usage{
shannon_entropy(dens_fn, upper = 100)
}
\arguments{
\item{dens_fn}{A function of one argument returning the density \eqn{f(x)}.}

\item{upper}{Upper integration limit (default 100).}
}
\value{
Scalar numeric.
}
\description{
Computes the Shannon differential entropy
\deqn{H(f) = -\int_0^\infty f(x)\log f(x)\,dx}
for a non-negative continuous random variable with density \code{dens_fn}.
}
\examples{
# Exponential(1): H = 1
shannon_entropy(function(x) dexp(x, rate = 1))

# Exponential(2): H = 1 - log(2)
shannon_entropy(function(x) dexp(x, rate = 2))

}
\references{
Shannon C.E. (1948). A mathematical theory of communication. *Bell System
Technical Journal*, 27(3), 379--423.

Smitha S., Rajesh G., Jayalekshmi S. (2024). *Journal of the Indian
Statistical Association*, 62(1), 81--93.
}
\seealso{
\code{\link{residual_entropy}}, \code{\link{info_gen_function}}
}
