  We study commutative algebras with Gorenstein duality, i.e. algebras $A$
equipped with a non-degenerate bilinear pairing such that $\langle
ac,b\rangle=\langle a,bc\rangle$ for any $a,b,c\in A$. If an algebra $A$ is
Artinian, such pairing exists if and only if $A$ is Gorenstein. We give a
description of algebras with Gorenstein duality as a quotients of the ring of
differential operators by the annihilator of an explicit polynomial (or more
generally formal polynomial series). This provides a calculation of Macaulay's
inverse systems for (not necessarily Artinian) algebras with Gorenstein
duality. Our description generalizes previously know description of graded
algebras with Gorenstein duality generated in degree 1.
  Our main motivation comes from the study of even degree cohomology rings. In
particular, we apply our main result to compute the ring of cohomology classes
of even degree of toric bundles and the ring of conditions of horospherical
homogeneous spaces.
