Exemplo n.º 1
0
def sph_jn(n,z):
    """Compute the spherical Bessel function jn(z) and its derivative for
    all orders up to and including n.
    """
    if not (isscalar(n) and isscalar(z)):
        raise ValueError("arguments must be scalars.")
    if (n!= floor(n)) or (n<0):
        raise ValueError("n must be a non-negative integer.")
    if (n < 1): n1 = 1
    else: n1 = n
    if iscomplex(z):
        nm,jn,jnp,yn,ynp = specfun.csphjy(n1,z)
    else:
        nm,jn,jnp = specfun.sphj(n1,z)
    return jn[:(n+1)], jnp[:(n+1)]
Exemplo n.º 2
0
Arquivo: basic.py Projeto: minrk/scipy
def sph_jn(n, z):
    """Compute the spherical Bessel function jn(z) and its derivative for
    all orders up to and including n.
    """
    if not (isscalar(n) and isscalar(z)):
        raise ValueError, "arguments must be scalars."
    if (n != floor(n)) or (n < 0):
        raise ValueError, "n must be a non-negative integer."
    if (n < 1): n1 = 1
    else: n1 = n
    if iscomplex(z):
        nm, jn, jnp, yn, ynp = specfun.csphjy(n1, z)
    else:
        nm, jn, jnp = specfun.sphj(n1, z)
    return jn[:(n + 1)], jnp[:(n + 1)]