This is probably a very naive question:
I am trying to understand if the zero-set of a real-analytic function in several variables can be "wilder" than the zero-set of a polynomial in several variables: Let $f:\mathbb{R}^n \to \mathbb{R}$ ($n>1$) be a real-analytic function which is not identically zero, and set $Z=f^{-1}(0)$.
Can $Z$ always be realized as the zero set of a polynomial? (or a system of polynomials)?
I think that an equivalent ways to phrase this question are: 1. Is $Z$ Zariski closed? or 2. Does $Z$ form an algebraic subvariety of positive codimension in $\mathbb{R}^n$? However, I know almost nothing on algebraic geometry, so I am not sure about this.
Consider e.g. $f(x,y) = y - e^x$. The curve $y = e^x$ is not the zero-set of any polynomial.
Namely if $P(x, e^x) = 0$ for all real $x$, this would also be true for complex $x$, and $P(\log y +2\pi i n, y) = 0$ for all integers $n$ and all $y \ne 0$, implying $P(x, y) = 0$ for all $x$.
EDIT: The point is that a non-constant polynomial can only have finitely many zeros, but $P(\cdot, y)$ has infinitely many.