Approximation of attractors by algebraic or analytic sets