Example #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))
Example #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))
Example #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))
Example #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
Example #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
Example #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))
Example #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
Example #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)
Example #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)
def f11(x):
    # bessel_Y1
    return mpmath.bessely(1, x)
def f10(x):
    # bessel_Y0
    return mpmath.bessely(0, x)
Example #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
Example #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
Example #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))
Example #15
0
def mp_spherical_yn(l, z):
    return mpmath.sqrt(mpmath.pi / 2.0 / z) * mpmath.bessely(l + 0.5, z)
Example #16
0
def sphbessely(nu, x):
    from mpmath import bessely

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

    return sqrt(pi / (2 * x)) * bessely(nu + mpf('0.5'), x)
Example #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