def rosenbrock_gendd(xd, A=<NUM_LIT:10>, order=<NUM_LIT:3>):
xp = xd[<NUM_LIT:1>:]<EOL>xi = xd[:-<NUM_LIT:1>]<EOL>r1 = A*(xp - xi**order)<EOL>r2 = <NUM_LIT:1> - xi<EOL>return np.append(r1, r2)<EOL>
A higher-dimensional modification of a generalized rosenbrock
function, as a set of residuals (cost = sum(residuals**2))

The standard modified function is with data = zeros(N), with a
global minimum at xd=ones(d). This function is a coupled model,
polynomial in the first d-1 parameters. Its data-space dimension
(2d-2) is greater than its model-space dimension (d) for d > 2.

Parameters
----------
    - xd : d-element list-like
        The x,y parameters of the model.
    - order : Int, optional
        The order of the model nonlinearity. Default is 3

Returns
-------
    (2d-2)-element list-like
        The residuals of the model.

Notes
-----
    Based on the multidimensional variation
        f(x) = \sum_{i=1}^{N-1} 100(x_{i+1} - x_i&2) + (1-x_i)^2
This gives a data space of dimension 2*(N-1) =2N-2 and a parameter
space of dimension N. According to wikipedia, the quadratic version
has 1 minimia for N=3 at (1,1,1), 2 minima for 4<=N<=7. See:
https://en.wikipedia.org/wiki/Rosenbrock_function#Multidimensional_generalisations