Let $f:[0,1]\rightarrow \mathbb{R}$ be a continuously differentiable function that reaches a global maximum at $x^*\in(0,1)$. Now, consider its 'discrete' counterpart. That is, consider the collection $\{(x_1,f(x_1)),(x_2,f(x_2)),\ldots,(x_n,f(x_n)\}$ where $x_1<x_2<\cdots <x_n$, and $h=x_{n+1}-x_{n}$ 'small'.
Under what conditions on $h$ (or something else) can I claim that the maximum found using the continuous function $f$ approximates reasonably well the value $f(\hat{x})$ satisfying $f(\hat{x})\geq f(x_i)$ for all $x_i\in \{x_1,x_2,\ldots,x_n\}$?
Thanks for your help!
This depends on "how continuous" $f$ is. It's possible to construct continuously differentiable functions that have arbitrarily narrow spikes (e.g. Gaussian as $\sigma \rightarrow 0$). For these functions, sampling at $h$ sized intervals can be arbitrarily wrong.
Using the $\epsilon$-$\delta$ definition of continuity, for any error tolerance $\epsilon > 0$ there exists $\delta > 0$ such that when $|x - \hat x| < \delta$, we have $|f(x) - f(\hat x)| < \epsilon$. In other words, you need to know about $f$ to determine a bound for $h$.
Using differentiability and the mean value theorem, we can deduce that $|f(x) - f(\hat x)| \le |x - \hat x| \sup_{x \in (0, 1)} |f'(x)|$.