Let $M$ be a differentiable manifold and $f\colon M\to\mathbf{R}$ a differentiable function. If $\mathrm{d}f=0$, what can we say about $f$? Is it constant?
Motivation:
In Thermodynamics, we consider some "state space" $M$ and "state variables" $\newcommand{\dif}{\mathrm{d}}$ \begin{align} X_1,\ldots,X_n,\xi_1,\ldots,\xi_n\colon M&\to\mathbf{R} \end{align} such that the function $(X_1,\ldots,X_n)\colon M\to\mathbf{R}^n$ is a chart (in particular, injective).
The energy $E\colon M\to\mathbf{R}$ is then said to satisfy $$\dif E=\sum_{i=1}^n\xi_i\cdot\dif X_i$$ and I was wondering if $E$ is determined up to some constant by this.
I expect it's piecewise constant. If the manifold is a pair of spheres, $f$ might take one value on one sphere and a different value on the other.