Parametric surfaces are very easy to create. A parametric surface is defined by two parameters—usually denoted by $u$ and $v$—that have a certain range and a parametric equation that maps those parameters to a 3D vector. To discretize the surface, we let $u$ and $v$ range in their defined range with a certain uniform step size and apply the parametric equations to get the locations. An implementation of your second example is as follows:

To construct a surface from that, just use the polygons of a grid, because the structure of the output points is inherently similar to that of the grid:

The first example is a subset of what we just created, where it is simply defined to have the X equation to be $u$ and the Y equation to be $v$. Or more simply, it can be treated as a multi-variable function of the x and y locations of a grid points. In fact, the second example can also be described as a multi-variable function of the x and y locations of a circle mesh of a high inner loop count. You can implement this yourself as a practice.