Could someone please translate this code into some mathematical notation? this code is to generate a dateset
def make_1dregression_data(n=21):
    np.random.seed(0)
    xtrain = np.linspace(0.0, 20, n)
    xtest = np.arange(0.0, 20, 0.1)
    sigma2 = 4
    w = np.array([-1.5, 1/9.])
    fun = lambda x: w[0]*x + w[1]*np.square(x)
    ytrain = fun(xtrain) + np.random.normal(0, 1, xtrain.shape) * \
        np.sqrt(sigma2)
    ytest= fun(xtest) + np.random.normal(0, 1, xtest.shape) * \
        np.sqrt(sigma2)
    return xtrain, ytrain, xtest, ytest

xtrain, ytrain, xtest, ytest = make_1dregression_data(n=21)

Could someone please translate this Python code into some mathematical notation? I've read this code several times and failed to find what distribution it is.
I know it is based on normal distribution although I cannot imagine what this part w[1]*np.square(x) is doing.
 A: Although this question relies heavily on Python, the answer does appear to benefit from some statistical reasoning.
This function creates "training" and "test" datasets of points $(x_i,y_i)$ for a regression model
$$y_i = w_0 x_i + w_1 x_i^2 + \varepsilon_i \sigma$$
where $\varepsilon_i$ are independent variables with standard Normal distributions.  The values of the parameters $w_0,$ $w_1,$ and $\sigma$ are hard-coded into the function.  The values of the $x_i$ in each dataset are equally spaced from $0$ to $20$ (although the test set does not include $20$). The test set is hard-coded (as $(0.0, 0.1, 0.2, \ldots, 19.9)$) while the training set size is provided by the caller in the argument n.

The model can also be compactly written by stating that the observations $y_i$ are realizations of independent random variables $Y_i$ having Normal$(w_0x_i+w_1x_i^2, \sigma^2)$ distributions; this frequently is abbreviated as $$Y_i\ {\sim}_{\operatorname{iid}}\ \mathcal{N}(w_0x_i + w_1 x_i^2, \sigma^2).$$

That answers the question about what distribution is involved.
This is the setting for ordinary least squares regression of a response $y$ against "features" or "explanatory variables" $x$ and $x^2.$  Thus, it posits that 

the points $(x_i,y_i)$ deviate from the parabola $y=w_0x + w_1 x^2$ by means of independent random variations in the $y$ coordinates.  

That answers the question about what the squared term is doing.
