Number of zeroes of polynomials when extended to square roots I'm interested in knowing about the number of real valued zeroes of polynomials extended to include square roots.
First let's call a polynomial extended to include square roots a polyquaral. A polyquaral can be recursively defined as follows :
$p=c \in \mathbb{R} | x | p_1 +p_2 | p_1*p_2 | \sqrt{p_1}$ ($x$ is a variable and $p_1$ and $p_2$ are polyquarals)
For instance this is a polyquaral : $\sqrt{6+\sqrt{x}} + \sqrt{7+x\sqrt{x}} + -0.1x - 6$
Let us define the degree of a polyquaral :
$d(c)=0 | d(x)=1 |d(p_1 +p_2) = max(d(p_1),d(p_2)) | d(p_1*p_2) = d(p_1)+d(p_2) | d(\sqrt{p_1}) = d(p_1)/2$
Next I would like to informally introduce a notion called the square root nesting, noted $i$, of a polyquaral. Which should correspond to the highest number of nested square roots in a polyquaral. For example a term like $\sqrt{6+\sqrt{x}}$ has two nested square roots.
$i(c)=0 | i(x)=0 |i(p_1 +p_2) = max(i(p_1),i(p_2)) | i(p_1*p_2) = max(i(p_1),i(p_2)) | i(\sqrt{p_1}) = i(p_1)+1$
This definition is informal as the rule for multiplication is false in general (if you multiply $\sqrt{x}$ by itself you get $x$ and reduce the amount of nested square rooting), but making it formal would take too much time at this point.
I'm interested in knowing what is the number of zeroes (over $\mathbb{R}$ of a polyquaral $p$ depending on the degree of $p$, and the number of nested squareroots. (maybe those are not the relevant values to answer this question, in which case feel free to modify them). There is a trivial upperbound where you just solve $p=O$ by repeatedly moving the most "square-root nested" term to the right and squaring both sides. At the end you end up with a polynomial equation of a certain (large) degree. This degree grows at least in $d*2^{i}$ where $d$ is the highest degree appearing in $p$ and $i$ is the nesting of square roots. In actuality in grows even faster cause if you have $n$ terms with the same amount of nested square roots you need to repeat the aforementionned algorithm at least $n$ times it seems to get rid of all the squareroots.
But in reality i would guess that the amount of zeroes of a polyquaral is much lower than this, maybe affine in the degree of the polyquaral. Has there been any study on this ? If one could prove an upperbound of $d*2^{i}$ on the number of zeroes it would actually suffice for what I need.
A other way to look at this problem might be as an analytic one, by computing polyquarals derivative, but i didn't get very far that way.
 A: There are examples with lots of zeros.
First, note that $p(x) = x - \sqrt{x^2}$ has an uncountable number of zeros. However, we can consider this to be a degenerate case: this can happen only if we get the identically zero polynomial after clearing all of the square roots.
In the next examples I will write $|x|$ instead of $\sqrt{x^2}$ for convenience; they are the same function for real $x$.
Let's look at the family of examples $q_n(x)$ that extend the following pattern in the natural way:
$$q_3(x) = \left|\left|\left|x-2^3\right| - 2^2\right| - 2^1\right| -2^0.$$
The function $q_n(x)$ has $2^n$ zeros (at the odd integers between $0$ and $2^{n+1}$). This example achieves the full number of zeros possible, as the polynomial resulting from eliminating the square roots has degree $2^n$.
Now consider the family of examples
$$p_n(x) = -(2n-1) + \sum_{k=1}^{2n-1}(-1)^{k+1} \left|x-2k\right|.$$
Here $i(p_n) = 1$ and $d(p_n) = 1$, yet $p_n(x)$ has $2n$ zeros (at the odd integers between $0$ and $4n$). So there can be no upper bound that depends only on $i(p)$ and $d(p)$.
(As a side note, I was surprised to discover that I had come up with the same example twice: $q_n(x)$ is the exact same function as $p_{2^{n-1}}(x)$!)
If you don't like the fact that $q_n(x)$ and $p_n(x)$ are not differentiable, we can perturb these functions slightly to make them infinitely differentiable on the real line: just replace $|x|$ with $\sqrt{x^2 + \epsilon}$ for a sufficiently small positive $\epsilon$.
Finally, an explicit upper bound for the number of zeros of $p(x)$ is given by
$$d(p)\cdot 2^{j(p)}$$
where $d(p)$ is the (possibly fractional) degree of $p$ as you have defined it, and $j(p)$ is the number of distinct square roots that appear in $p$.
This can be derived as follows: multiply $p(x)$ by all of its conjugates, where each conjugate is obtained by replacing each distinct square root in $p$ with either its positive or negative version. This results in a polynomial in $\mathbb{R}[x]$ of degree at most $d(p) \cdot 2^{j(p)}$.
One way to interpret this result is that if the signs of the square roots are chosen independently at random, the expected value of the number of zeros is at most $d(p)$.
