def lqn(n,z):
if not (isscalar(n) and isscalar(z)):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (n != floor(n)) or (n < <NUM_LIT:0>):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if (n < <NUM_LIT:1>):<EOL><INDENT>n1 = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>n1 = n<EOL><DEDENT>if iscomplex(z):<EOL><INDENT>qn,qd = specfun.clqn(n1,z)<EOL><DEDENT>else:<EOL><INDENT>qn,qd = specfun.lqnb(n1,z)<EOL><DEDENT>return qn[:(n+<NUM_LIT:1>)],qd[:(n+<NUM_LIT:1>)]<EOL>
Compute sequence of Legendre functions of the second kind,
    Qn(z) and derivatives for all degrees from 0 to n (inclusive).