Can we approximate continuous functions arbitrarily well with polynomials? (beyond Weierstrass )

Let $$f:(0,1) \to \mathbb{R}$$ be continuous, and let $$\delta:(0,1) \to \mathbb{R}$$ be continuous and positive.

Does there always exist a polynomial $$p(x)$$ satisfying $$|f(x)-p(x)| < \delta(x)$$ for every $$x \in (0,1)$$?

Edit: I should have written $$[0,1]$$ (the closed interval) as the domain instead of $$(0,1)$$. (to rule out problems which come from the fact $$f$$ is not bounded, or uniformly continuous; if $$f$$ is not bounded, then it cannot be approximated by polynomials).

I guess that the answer is negative, but I don't see how to build a "sufficiently bad" $$\delta$$.

When $$\delta$$ is constant, this is just the Weierstrass approximation theorem.

Moreover, if we allow $$p(x)$$ to be an arbitrary smooth function, then we can always achieve a $$\delta$$-approximation, via a partition of unity argument.

• You can do Weierstrass again provided that $f$ is uniformly continuous and $\delta$ is bounded below away from zero (because in this case you're really just applying Weierstrass to the extension of $f$ to $[0,1]$ and using $\inf \delta$ as your tolerance). If $\delta$ is not bounded below away from zero (and $f$ is still uniformly continuous) then I think you can do it again, by splitting $p$ into an interpolant of $f$ at the endpoints plus a corrector, but I'd have to mess with the estimates to make sure things still work out in a neighborhood of the endpoints. – Ian Mar 28 '19 at 14:59
• If $f$ is not uniformly continuous then things can certainly break when $f$ is not bounded, and I suspect they can break when $f$ has an oscillatory singularity at one of the endpoints as well. – Ian Mar 28 '19 at 14:59
• It's easy to show that $\sin(1/x)$ can't be approximated within $\delta$ on $(0,1)$ by a polynomial if $\delta < 1/2$. – Robert Israel Mar 28 '19 at 15:02

On $$(0,1)$$, no, even if $$\delta$$ is constant, because $$f$$ might not be bounded while polynomials are. Weierstrass requires a closed, bounded interval.
EDIT: With the interval as $$[0,1]$$, $$\min_{x \in [0,1]} \delta(x)$$ exists and is positive, so we might as well replace $$\delta$$ by that constant, and then we can use the Weierstrass theorem.
• @AsafShachar Unless $\delta$ on $[0,1]$ has zeros, it becomes sufficient to just do Weierstrass again, once you switch over to the compact case. – Ian Mar 28 '19 at 15:06
• But if "positive" means $> 0$, $\delta$ can't have zeros. – Robert Israel Mar 28 '19 at 15:07
• @RobertIsrael Indeed; I'm just pointing out a possible generalization that is actually nontrivial. Still, I think given an interpolant $q$ at the zeros of $\delta$ you can then take $p=q(1+r)$ where $r$ is a Weierstrass-type approximation of $\frac{f-q}{q}$. – Ian Mar 28 '19 at 15:08
• @Ian Thanks, you are right. I should have thought more about a careful formulation of the question. I guess that we could try to make the question less trivial in one of two ways: (1) allow $\delta$ to have finitely many zeros. (2) Keep the domain open, but assume that $f$ is bounded. – Asaf Shachar Mar 28 '19 at 15:12