Suppose $f \in C([0,1]^2)$. If I fix any $x \in [0,1]$, then for $\epsilon > 0$, I can find some $h = h(\epsilon,x) > 0$ so that $$\left| \int_0^1 f(x,y) dy - h\sum_{j}f(x,y_j)\right| < \epsilon $$ where $y_j = jh$. This is just by the fact that $x \mapsto \int_0^1 f(x,y)dy$ is uniformly continuous on $[0,1]$ and Riemann sums converge.
Is it possible to also do this uniformly over $x$, as in, can I find $h = h(\epsilon) > 0$ such that $$\sup_{x \in [0,1]} \left| \int_0^1 f(x,y) dy - h\sum_{j}f(x,y_j)\right| < \epsilon$$ or do I need more assumptions on $f$ to get this? Maybe $f(\cdot,y)$ is Lipschitz uniformly over $y$, as in, there exists $L > 0$ so that $|f(x_1,y)-f(x_2,y) \leq L|x_1 - x_2|$ for all $y,x_1,x_2 \in [0,1]$? Even with this condition it is not clear to me how to get my result. Maybe if I relax the norm from $C^0$ to $L^2$?
Any thoughts or known results in this direction would be greatly appreciated. Thanks!
The critical condition here is that $f$ needs to be uniformly continuous. This is equivalent to the condition that $$ \lvert f(z_1) - f(z_2)\rvert \leq \delta(\lVert z_1 - z_2 \rVert), $$ where $\delta$ is a decreasing function such that $\lim_{x\rightarrow 0} \delta(x) = 0$. Fortunately, all continuous functions with compact domains are uniformly continuous, so this holds for any $f \in C([0, 1]^2)$.
So now, if we choose $y_j = j/n$ we have, arguing as usual for the Riemann sum that \begin{align*} \bigg\lvert\int_{y_{j-1}}^{y_j} f(x, y)\, dy - \frac{1}{n} f(x, y_j)\bigg\rvert \leq \int_{y_{j-1}}^{y_j} \lvert f(x, y) - f(x, y_j)\rvert\, dy \leq \frac{1}{n} \delta \Bigl(\frac{1}{n}\Bigr) \end{align*} since $\lVert(x, y) - (x, y_j)\rVert \leq 1/n$ for any $x$ and $y \in [y_{j-1}, y_j]$.
Now, summing over the $j$, we have that \begin{align*} \bigg\lvert\int_{0}^{1} f(x, y)\, dy - \frac{1}{n} \sum_{j-1}^n f(x, y_j)\bigg\rvert \leq \sum_{j=1}^n \bigg\lvert\int_{y_{j-1}}^{y_j} f(x, y)\, dy - \frac{1}{n} f(x, y_j)\bigg\rvert \leq \delta \Bigl(\frac{1}{n}\Bigr), \end{align*} and moreover that that bound holds uniformly in $x$.
So now, our $h$ is $1/n$, where $n$ is large enough that $\delta(1/n) < \epsilon$ (which we can always find since $\delta(x) \downarrow 0$).