  Given ideals $I,J$ of a noetherian local ring $(R, \mathfrak m)$ such that
$I+J$ is $\mathfrak m$-primary and a finitely generated $R$-module $M$, we
associate an invariant of $(M,R,I,J)$ called the $h$-function. Our results on
$h$-functions allow extensions of the theories of Frobenius-Poincar\'e
functions and Hilbert-Kunz density functions from the known graded case to the
local case, answering a question of V.Trivedi. When $J$ is $\mathfrak
m$-primary, we describe the support of the corresponding density function in
terms of other invariants of $(R, I,J)$. We show that the support captures the
$F$-threshold: $c^J(I)$, under mild assumptions, extending results of V.
Trivedi and Watanabe. The $h$-function encodes Hilbert-Samuel, Hilbert-Kunz
multiplicity and $F$-threshold of the ideal pair involved. Using this feature
of $h$-functions, we provide an equivalent formulation of a conjecture of
Huneke, Musta\c{t}\u{a}, Takagi, Watanabe; recover a result of Smirnov and
Betancourt; prove that a result of Hanes comparing multiplicities, is
equivalent to an a priori weaker containment condition on ideals. We also point
out that a conjecture of Smirnov-Betancourt as stated is false and suggest a
correction which we relate to the conjecture of Huneke et al.
  We develop the theory of $h$-functions in a more general setting which yields
a density function for $F$-signature. A key to many results on $h$-functions is
a `convexity technique' that we introduce, which in particular proves
differentiability of Hilbert-Kunz density functions almost everywhere on
$(0,\infty)$, thus contributing to another question of Trivedi.
