Suppose that $f \colon [0, 1] \to \mathbb{R}$ is a $C^\infty$ function withsatisfying the constraints $$ f(0) = f'(0) = f^{''}(0) = 0, \quad \mbox{and} \quad \int_0^1 (f''(y))^2 \, dy \leq 1. $$$$ f(0) = f'(0) = f(1) = f'(1) = 0, \quad \mbox{and} \quad \int_0^1 (f''(y))^2 \, dy \leq 1. $$ Denote this class of functions $\mathcal{F}$$\mathcal{F}.$
I want to know what is the best approximation one can give of the $L^2$ norm of $f$ in terms of the evaluation of $f$ on a uniform grid. Basically, I want to know what we can say about $$ \sup_{f \in \mathcal{F}} \Big\{\int_0^1 f^2(y) \, dy - \frac{1}{n}\sum_{i=1}^n f^2(i/n) \Big\}. $$ My conjecture is that the error should go down as $n^{-4}$ since the quadratic interpolant should have this error, but I had difficulty checking this to be the case.
Addendum: I have added an additional periodicity constraint, primarily because as indicated by the argument from Iosif below, one can apply the Euler-Maclaurin formula to obtain $n^{-p}$ for any $p$ provided that $f \in C^\infty$ is periodic on $[0, 1]$. Hence, let's make the problem easier. We assume periodicity for the function and first order derivative. The naive application of Euler-Maclaurin gives an upper bound on the quantity above of $O(1/n^2)$ uniformly over the class. However, I cannot construct an $f$ that actually achieves this, subject to my constraints.