Repository: scipy/scipy
File: scipy/special/_basic.py (Python)

Code before:

    >>> euler(13).astype(np.int64)
    array([      1,       0,      -1,       0,       5,       0,     -61,
                 0,    1385,       0,  -50521,       0, 2702765,       0])

    >>> euler(22)[-1]  # Exact value of E(22) is -69348874393137901.
    -69348874393137976.0

    """
    if not isscalar(n) or (n < 0):
        raise ValueError("n must be a non-negative integer.")
    n = int(n)
    if (n < 2):
        n1 = 2
    else:
        n1 = n
    return _specfun.eulerb(n1)[:(n+1)]


def lqn(n, z):
    """Legendre functions of the second kind.

    Compute sequence of Legendre functions of the second kind, :math:`Q_n(z)` and
    derivatives for all degrees from :math:`0` to :math:`n` (inclusive).
    Returns two arrays of size :math:`(n+1,)` containing :math:`Q_n(z)` and
    :math:`Q_n'(z)`.

    Parameters
    ----------
    n : int
        Maximum degree of the Legendre functions.
    z : array_like, complex
        Real or complex input values.

    Returns
    -------
    Qn_z : ndarray, shape (n+1,) + shape(z)
        Values for all degrees 0..n
    Qn_d_z : ndarray, shape (n+1,) + shape(z)
        Derivatives for all degrees 0..n

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html

    Examples
    --------
    Compute :math:`Q_n(x)` and its derivatives on an interval.


Review comment (performance):
I think there could be an argument to be made here that using latex here in the summary might be overkill since it isn't quite as readable for terminal/IDE users. Of course feel free to continue improving the Latex within the notes etc sections. What do you think?

Also the shape doesn't seem to match the returns section
```suggestion
    Compute sequence of Legendre functions of the second kind, ``Qn(z)`` and
    derivatives for all degrees from 0 to `n` (inclusive).
    Returns two arrays of size ``(n+1,) + z.shape`` containing ``Qn(z)`` and
    ``Qn'(z)``.
```

Code after:

    >>> euler(13).astype(np.int64)
    array([      1,       0,      -1,       0,       5,       0,     -61,
                 0,    1385,       0,  -50521,       0, 2702765,       0])

    >>> euler(22)[-1]  # Exact value of E(22) is -69348874393137901.
    -69348874393137976.0

    """
    if not isscalar(n) or (n < 0):
        raise ValueError("n must be a non-negative integer.")
    n = int(n)
    if (n < 2):
        n1 = 2
    else:
        n1 = n
    return _specfun.eulerb(n1)[:(n+1)]


def lqn(n, z):
    """Legendre functions of the second kind.

    Compute sequence of Legendre functions of the second kind, ``Qn(z)`` and
    derivatives for all degrees from 0 to `n` (inclusive).
    Returns two arrays of size ``(n+1,) + z.shape`` containing ``Qn(z)`` and
    ``Qn'(z)``.

    Parameters
    ----------
    n : int
        Maximum degree of the Legendre functions.
    z : array_like, complex
        Real or complex input values.

    Returns
    -------
    Qn_z : ndarray, shape (n+1,) + shape(z)
        Values for all degrees ``0..n``
    Qn_d_z : ndarray, shape (n+1,) + shape(z)
        Derivatives for all degrees ``0..n``

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html

    Examples
    --------
    Compute :math:`Q_n(x)` and its derivatives on an interval.