Warm-up and main questions:
Let $X \subset \mathbb{R}^n$ be a semialgebraic set and $x_1, x_2 \in X$. How can I effectively check if $x_1$ and $x_2$ are in the same connected component of $X$?
Let $f \in \mathbb{R}[x]$ be a multivariable polynomial. Let $X_1, X_2 \subset \mathbb{R}^n$ be an algebraic curves with parametrisation at infinity $g_1, g_2$ respectivly ($g_1:[0,\infty)\to X_1$, $\lim_{t\to\infty}|g_1(t)|=+\infty $, $g_2:[0,\infty)\to X_2$, $\lim_{t\to\infty}|g_2(t)|=+\infty $ ). Assume that $$\lim_{t\to\infty}(f(g_1(t))=\lim_{t\to\infty}(f(g_2(t))=0.$$ How can I check if $g_1([R,\infty))$ and $g_2([R,\infty))$ are in the same connected component of the set $f^{-1}((-\varepsilon, \varepsilon))$ (for $\varepsilon>0$ small enough, $R>0$ big enough)?