  In this paper we construct a q-analogue of the Legendre transformation, where
q is a matrix of formal variables defining the phase space braidings between
the coordinates and momenta (the extensive and intensive thermodynamic
observables). Our approach is based on an analogy between the semiclassical
wave functions in quantum mechanics and the quasithermodynamic partition
functions in statistical physics. The basic idea is to go from the
q-Hamilton-Jacobi equation in mechanics to the q-Legendre transformation in
thermodynamics. It is shown, that this requires a non-commutative analogue of
the Planck-Boltzmann constants (hbar and k_B) to be introduced back into the
classical formulae. Being applied to statistical physics, this naturally leads
to an idea to go further and to replace the Boltzmann constant with an infinite
collection of generators of the so-called epoch\'e (bracketing) algebra. The
latter is an infinite dimensional noncommutative algebra recently introduced in
our previous work, which can be perceived as an infinite sequence of
"deformations of deformations" of the Weyl algebra. The generators mentioned
are naturally indexed by planar binary leaf-labelled trees in such a way, that
the trees with a single leaf correspond to the observables of the limiting
thermodynamic system.
