

@defun
def legenp(ctx, n, m, z, type=2, **kwargs):
    n = ctx.convert(n)
    m = ctx.convert(m)
    if (not m):
        return ctx.legendre(n, z, **kwargs)
    if (type == 2):

        def h(n, m):
            g = (m * 0.5)
            T = ([(1 + z), (1 - z)], [g, (- g)], [], [(1 - m)], [(- n), (n + 1)], [(1 - m)], (0.5 * (1 - z)))
            return (T,)
        return ctx.hypercomb(h, [n, m], **kwargs)
    if (type == 3):

        def h(n, m):
            g = (m * 0.5)
            T = ([(z + 1), (z - 1)], [g, (- g)], [], [(1 - m)], [(- n), (n + 1)], [(1 - m)], (0.5 * (1 - z)))
            return (T,)
        return ctx.hypercomb(h, [n, m], **kwargs)
    raise ValueError('requires type=2 or type=3')

dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/functions/orthogonal.py legenp/original