def make_bessel_y1_vals(): from mpmath import bessely x = [mpf('0.1')] + linspace(1, 15, 15) y1 = [bessely(1, val) for val in x] return make_special_vals('bessel_y1_vals', ('x', x), ('y1', y1))
def make_bessel_y_vals(): from mpmath import bessely nu = [ mpf('0.5'), mpf('1.25'), mpf('1.5'), mpf('1.75'), mpf(2), mpf('2.75'), mpf(5), mpf(10), mpf(20) ] x = [ mpf('0.2'), mpf(1), mpf(2), mpf('2.5'), mpf(3), mpf(5), mpf(10), mpf(50) ] nu, x = zip(*outer(nu, x)) y = [bessely(*vals) for vals in zip(nu, x)] return make_special_vals('bessel_y_vals', ('nu', nu), ('x', x), ('y', y))
def mpbessely(v, x): r = float(mpmath.bessely(v, x, **HYPERKW)) if abs(r) > 1e305: # overflowing to inf a bit earlier is OK r = np.inf * np.sign(r) if abs(r) == 0 and x == 0: # invalid result from mpmath, point x=0 is a divergence return np.nan return r
def make_bessel_y_vals(): from mpmath import bessely nu = [mpf('0.5'), mpf('1.25'), mpf('1.5'), mpf('1.75'), mpf(2), mpf('2.75'), mpf(5), mpf(10), mpf(20)] x = [mpf('0.2'), mpf(1), mpf(2), mpf('2.5'), mpf(3), mpf(5), mpf(10), mpf(50)] nu, x = zip(*outer(nu, x)) y = [bessely(*vals) for vals in zip(nu, x)] return make_special_vals('bessel_y_vals', ('nu', nu), ('x', x), ('y', y))
def sph_yn_bessel(n, z): out = bessely(n + mpf(1)/2, z)*sqrt(pi/(2*z)) if mpmathify(z).imag == 0: return out.real else: return out
def test_bessely(self): assert_mpmath_equal(sc.yv, _exception_to_nan(lambda v, z: mpmath.bessely(v, z, **HYPERKW)), [Arg(-1e100, 1e100), Arg()], n=1000)
def test_bessely(self): assert_mpmath_equal( sc.yv, _exception_to_nan(lambda v, z: mpmath.bessely(v, z, **HYPERKW)), [Arg(-1e100, 1e100), Arg()], n=1000)
def f11(x): # bessel_Y1 return mpmath.bessely(1, x)
def f10(x): # bessel_Y0 return mpmath.bessely(0, x)
def mpbessely(v, x): r = float(mpmath.bessely(v, x)) if abs(r) == 0 and x == 0: # invalid result from mpmath, point x=0 is a divergence return np.nan return r
def mpbessely(v, x): r = complex(mpmath.bessely(v, x, **HYPERKW)) if abs(r) > 1e305: # overflowing to inf a bit earlier is OK r = np.inf * np.sign(r) return r
def mp_spherical_dyn(l, z): return mpmath.sqrt(mpmath.pi / (2 * z)) * (mpmath.bessely(l + 0.5, z, 1) - mpmath.bessely(l + 0.5, z) / (2 * z))
def mp_spherical_yn(l, z): return mpmath.sqrt(mpmath.pi / 2.0 / z) * mpmath.bessely(l + 0.5, z)
def sphbessely(nu, x): from mpmath import bessely return sqrt(pi / (2 * x)) * bessely(nu + mpf('0.5'), x)
def sph_yn_bessel(n, z): out = bessely(n + mpf(1) / 2, z) * sqrt(pi / (2 * z)) if mpmathify(z).imag == 0: return out.real else: return out