Stone-Weierstrass theorem and Polynomials in multidimensional real space Stone-Weierstrass theorem on closed interval $[a, b]$ (in $\mathbb{R}$) states that any continuous function $f$ on $[a, b]$ can be approximated by polynomial function $p$, arbitrarily close to $f$.
From the above observation, I wonder if this can directly be applied to multidimensional case: is it true that any continuous function $f:X \rightarrow \mathbb{R}^m$, where $X \subset \mathbb{R}^n$ is compact, can be approximated by polynomial function $p$, i.e.,
$$\forall x\in X, \|f(x) - p(x)\|< \epsilon ?$$
If so, please show me a detailed example (qualitatively).
 A: The standard statement of the Stone-Weierstrass theorem is the following: let $X$ be a compact Hausdorff topological space, and $\mathcal A$ a subalgebra of the continuous functions from $X$ to $\mathbb R$ which is closed under complex conjugation and separates points ($\forall x_1\neq x_2\in X, \exists f\in\mathcal A$ such that $f(x_1)\neq f(x_2)$). Then $\mathcal A$ is dense in $C(X,\mathbb R)$ in the supremum norm.
Let's specify to your example, where $X$ is a closed, bounded subset of $\mathbb R^n$, and we have the subalgebra of polynomial functions (functions which are polynomial in each variable). These are certainly continuous, and closed under addition and pointwise multiplication, which is the multiplication of functions. The only difficulty is showing that it separates points. For two points $\vec x=(x_1,\ldots,x_n)$ and $\vec y=(y_1,\ldots,y_n)$, if they are not equal, then they are not equal for some index $i$, and the polynomial function $p(x_1,\ldots,x_n)=x_i$ separates them. So this subalgebra is dense.
A: Wikipedia quotes the Stone-Weierstrass theorem as

Stone–Weierstrass Theorem (real numbers). Suppose $X$ is a compact Hausdorff space and $A$ is a subalgebra of $C(X, \Bbb R)$ which contains a non-zero constant function. Then $A$ is dense in $C(X, \Bbb R)$ if and only if it separates points.

Which is to say, the only actual property of the closed interval $[a,b]$ that is necessary for the theorem is that it is compact and Hausdorff.
And the only necessary properties of the algebra of polynomial functions on this compact Hausdorff is that it is a subalgebra of the continuous real-valued functions (i.e. you can add and multiply polynomials together and scale them by real numbers, and still always end up with polynomials), that it contains some non-zero constant function, and that it can separate points (i.e. for any two points, there is at least one polynomial that evaluates to different values at the two points).
This immediately applies to polynomial functions in more than one variable, just as well as it does polynomial functions in a single variable, in addition to a whole host of other classes of functions (like sines of different frequencies for Fourier series).
