  John's fundamental theorem characterizing the largest volume ellipsoid
contained in a convex body $K$ in $\mathbb{R}^d$ has seen several
generalizations and extensions. One direction, initiated by V. Milman is to
replace ellipsoids by positions (affine images) of another body $L$. Another,
more recent direction is to consider logarithmically concave functions on
$\mathbb{R}^d$ instead of convex bodies: we designate some special, radially
symmetric log-concave function $g$ as the analogue of the Euclidean ball, and
want to find its largest integral position under the constraint that it is
pointwise below some given log-concave function $f$.
  We follow both directions simultaneously: we consider the functional
question, and allow essentially any meaningful function to play the role of $g$
above. Our general theorems jointly extend known results in both directions.
  The dual problem in the setting of convex bodies asks for the smallest volume
ellipsoid, called \emph{L{\"o}wner's ellipsoid}, containing $K$. We consider
the analogous problem for functions: we characterize the solutions of the
optimization problem of finding a smallest integral position of some
log-concave function $g$ under the constraint that it is pointwise above $f$.
It turns out that in the functional setting, the relationship between the John
and the L{\"o}wner problems is more intricate than it is in the setting of
convex bodies.
