Descartes' rule of signs I am trying to find a polynomial where for example the sign alternate 4 times but where there are only 2 positive real roots and where the remaining roots are negative real roots. The fact is that it is very easy to find a polynomial where the sign for instance alternate 3 times and where there are exactly 3 positive real roots. My problem is to find a polynomial which for instance alternate 4 times but where there are less than 4 positive real roots.
I hope it makes sense. Otherwise I would very much like to explain it further
 A: Consider for example $\,P(x) = (x^2+1)(x^2-ax+1) = x^4 - a x^3 + 2 x^2 - a x + 1\,$:

*

*for $\,a \gt 0\,$ it has $4$ sign changes;


*for $\,a \in (0,2)\,$ it has no real roots;


*for $\,a \ge 2\,$ it has two positive real roots.
$P(x^2)\,$ has the same number of sign changes as $\,P(x)\,$, so for $\,a \ge 2\,$ it has two positive and two negative real roots.

[ EDIT ] Additional note about this part of the question.

find a polynomial where for example the sign alternate 4 times but where there are only 2 positive real roots and where the remaining roots are negative real roots

No such polynomial exists. If the number of positive real roots is strictly less than the number of sign changes then the roots cannot be all real.
This follows from the complete statement of Descartes' rule of signs, as found for example at $§2.1$ and $§2.3.1$ in Historical account and ultra-simple proofs of Descartes's rule of signs, De Gua, Fourier, and Budan's rule.
Intuition in the simpler case of a polynomial with all coefficients non-zero is that the number of sign changes $\,n^+,n^-\,$ in the coefficients of $\,P(x), P(-x)\,$ adds up to $\,n=\text{deg}\, P$ since $\,P(-x)\,$ flips the sign of every other coefficient. If $\,n^+=4\,$ then $\,n^-=n-4\,$, so the number of negative roots is at most $\,n-4\,$. Since there are only two positive roots, there are at most $\,2+(n-4)$ $=n-2\,$ real roots, so at least two roots must be non-real complex.
