Coverage for scipy\special\_spherical_bessel.py: 0%

# Coverage for scipy\special\_spherical_bessel.py : 0%

## 18 statements 0 run 18 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | from __future__ import division, print_function, absolute_import from ._ufuncs import (_spherical_jn, _spherical_yn, _spherical_in, _spherical_kn, _spherical_jn_d, _spherical_yn_d, _spherical_in_d, _spherical_kn_d) def spherical_jn(n, z, derivative=False): r"""Spherical Bessel function of the first kind or its derivative. Defined as [1]_, .. math:: j_n(z) = \sqrt{\frac{\pi}{2z}} J_{n + 1/2}(z), where :math:`J_n` is the Bessel function of the first kind. Parameters ---------- n : int, array_like Order of the Bessel function (n >= 0). z : complex or float, array_like Argument of the Bessel function. derivative : bool, optional If True, the value of the derivative (rather than the function itself) is returned. Returns ------- jn : ndarray Notes ----- For real arguments greater than the order, the function is computed using the ascending recurrence [2]_. For small real or complex arguments, the definitional relation to the cylindrical Bessel function of the first kind is used. The derivative is computed using the relations [3]_, .. math:: j_n'(z) = j_{n-1}(z) - \frac{n + 1}{z} j_n(z). j_0'(z) = -j_1(z) .. versionadded:: 0.18.0 References ---------- .. [1] https://dlmf.nist.gov/10.47.E3 .. [2] https://dlmf.nist.gov/10.51.E1 .. [3] https://dlmf.nist.gov/10.51.E2 """ if derivative: return _spherical_jn_d(n, z) else: return _spherical_jn(n, z) def spherical_yn(n, z, derivative=False): r"""Spherical Bessel function of the second kind or its derivative. Defined as [1]_, .. math:: y_n(z) = \sqrt{\frac{\pi}{2z}} Y_{n + 1/2}(z), where :math:`Y_n` is the Bessel function of the second kind. Parameters ---------- n : int, array_like Order of the Bessel function (n >= 0). z : complex or float, array_like Argument of the Bessel function. derivative : bool, optional If True, the value of the derivative (rather than the function itself) is returned. Returns ------- yn : ndarray Notes ----- For real arguments, the function is computed using the ascending recurrence [2]_. For complex arguments, the definitional relation to the cylindrical Bessel function of the second kind is used. The derivative is computed using the relations [3]_, .. math:: y_n' = y_{n-1} - \frac{n + 1}{z} y_n. y_0' = -y_1 .. versionadded:: 0.18.0 References ---------- .. [1] https://dlmf.nist.gov/10.47.E4 .. [2] https://dlmf.nist.gov/10.51.E1 .. [3] https://dlmf.nist.gov/10.51.E2 """ if derivative: return _spherical_yn_d(n, z) else: return _spherical_yn(n, z) def spherical_in(n, z, derivative=False): r"""Modified spherical Bessel function of the first kind or its derivative. Defined as [1]_, .. math:: i_n(z) = \sqrt{\frac{\pi}{2z}} I_{n + 1/2}(z), where :math:`I_n` is the modified Bessel function of the first kind. Parameters ---------- n : int, array_like Order of the Bessel function (n >= 0). z : complex or float, array_like Argument of the Bessel function. derivative : bool, optional If True, the value of the derivative (rather than the function itself) is returned. Returns ------- in : ndarray Notes ----- The function is computed using its definitional relation to the modified cylindrical Bessel function of the first kind. The derivative is computed using the relations [2]_, .. math:: i_n' = i_{n-1} - \frac{n + 1}{z} i_n. i_1' = i_0 .. versionadded:: 0.18.0 References ---------- .. [1] https://dlmf.nist.gov/10.47.E7 .. [2] https://dlmf.nist.gov/10.51.E5 """ if derivative: return _spherical_in_d(n, z) else: return _spherical_in(n, z) def spherical_kn(n, z, derivative=False): r"""Modified spherical Bessel function of the second kind or its derivative. Defined as [1]_, .. math:: k_n(z) = \sqrt{\frac{\pi}{2z}} K_{n + 1/2}(z), where :math:`K_n` is the modified Bessel function of the second kind. Parameters ---------- n : int, array_like Order of the Bessel function (n >= 0). z : complex or float, array_like Argument of the Bessel function. derivative : bool, optional If True, the value of the derivative (rather than the function itself) is returned. Returns ------- kn : ndarray Notes ----- The function is computed using its definitional relation to the modified cylindrical Bessel function of the second kind. The derivative is computed using the relations [2]_, .. math:: k_n' = -k_{n-1} - \frac{n + 1}{z} k_n. k_0' = -k_1 .. versionadded:: 0.18.0 References ---------- .. [1] https://dlmf.nist.gov/10.47.E9 .. [2] https://dlmf.nist.gov/10.51.E5 """ if derivative: return _spherical_kn_d(n, z) else: return _spherical_kn(n, z)