Exemplo n.º 1
0
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))
Exemplo n.º 2
0
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))
Exemplo n.º 3
0
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))
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
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))
Exemplo n.º 7
0
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
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
def f11(x):
    # bessel_Y1
    return mpmath.bessely(1, x)
Exemplo n.º 11
0
def f10(x):
    # bessel_Y0
    return mpmath.bessely(0, x)
Exemplo n.º 12
0
 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
Exemplo n.º 13
0
 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
Exemplo n.º 14
0
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))
Exemplo n.º 15
0
def mp_spherical_yn(l, z):
    return mpmath.sqrt(mpmath.pi / 2.0 / z) * mpmath.bessely(l + 0.5, z)
Exemplo n.º 16
0
def sphbessely(nu, x):
    from mpmath import bessely

    return sqrt(pi / (2 * x)) * bessely(nu + mpf('0.5'), x)
Exemplo n.º 17
0
 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
Exemplo n.º 18
0
 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
Exemplo n.º 19
0
def sphbessely(nu, x):
    from mpmath import bessely

    return sqrt(pi / (2 * x)) * bessely(nu + mpf('0.5'), x)
Exemplo n.º 20
0
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