def recf_legendre_poly(result, x, special, n, cur_var, pos):
    """Implementation of the recursion formula for Legendre polynomials.
    The recursion formula is Bonnet's recursion formula
    P_n = (2n-1)/n * x * P_ {n-1}  - (n-1)* P_{n-2}.

        .. note::

        The procedure on how an recursion function is built can be found in the
        docstring of the recursion function for
        standard polynomials *recf_standard_poly*.

    :param result: Contains the observations along the first dimension
        and the function values of expansion w.r.t. an observation
        along the second dimension.
    :type result: numpy.ndarray

    :param x: The data to be expanded.
    :type x: numpy.ndarray

    :param special: Index of a special element to be considered in the
        recursion formula. In this case the special element is the 
        first order Legendre polynomial of the current variable.
    :type special: int

    :param n: The order of the function to be computed at this step.
    :type n: int

    :param cur_var: The index of the current variable to be considered in the
        recursion. This value will have to be lower than x.shape[1].
    :type cur_var: int

    :param pos: The index of the element to be computed, along the second
        dimension of result.
    :type int: int

    :returns: The vectorized result (along the observations) of the
        n-th recursion step of the cur_var-th variable.
    :rtype: numpy.ndarray

    .. admonition:: Reference

        https://en.wikipedia.org/wiki/Legendre_polynomials
    """
    return (2.0 * n - 1.0) / n * result[:, (special)] * result[:, (pos - 1)
        ] - (n - 1.0) / n * result[:, (pos - 2)]
