TITLE: The first part of the Hilbert sixteenth problem for elliptic polynomials
QUESTION [5 upvotes]: A polynomial $P(x,y)\in \mathbb{R}[x,y]$ is called an elliptic polynomial if its highest homogeneous part does not vanish on $\mathbb{R}^2\setminus\{0\}$.
Inspired by the first part of the Hilbert 16th problem we ask that: 

Is there an elliptic polynomial $P(x,y)\in \mathbb{R}[x,y]$ of degree $n$ which has a level set $P^{-1}(c)$  with more than $n$ connected components?
  Can  elliptic polynomials produce $M$-curves?

REPLY [2 votes]: You can get all the way up to $\binom{n-1}{2}+1 = g+1$, where $g$ is the genus. This is the maximal number of connected components a real curve of genus $g$ can have, so this is optimal.
To do this, I will use Viro's patchworking method. Itenberg and Viro already give an example of how to use patchworking to build a plane curve with $g+1$ connected components, so I will just show how to tweak it to use an elliptic polynomial.
I can't write a better explanation of patchworking than the one I just linked, so I'll assume you read it.
Take the triangulation from Figure 7. .
Along each edge on the outside of the figure, there are $2n$ small triangles. Pair them into $n$ pairs, and merge each pair with its common neighbor to make $n$ trapezoids. Leave the rest of the figure as before. It is easy to check that this subdivision is still coherent. The resulting plane curve has the same topology as the original figure, but the big loop which crossed the line at infinity $2n$ times before is now disjoint from it.
Poking around Viro's website, I came across slides from a talk on Hilbert's 16th problem. On page 48, he says that Hilbert, in 1891, found a construction of a curve with $g+1$ real components by perturbing a union of two conics. .
The slides don't give a detailed explanation of Hilbert's construction, but it looks like it would produce an elliptic polynomial.