python类sinh()的实例源码

generator.py 文件源码 项目:duct 作者: ducted 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def get(self):
        self.x += self.config.get('dx', 0.1)

        val = eval(self.config.get('function', 'sin(x)'), {
            'sin': math.sin,
            'sinh': math.sinh,
            'cos': math.cos,
            'cosh': math.cosh,
            'tan': math.tan,
            'tanh': math.tanh,
            'asin': math.asin,
            'acos': math.acos,
            'atan': math.atan,
            'asinh': math.asinh,
            'acosh': math.acosh,
            'atanh': math.atanh,
            'log': math.log,
            'abs': abs,
            'e': math.e,
            'pi': math.pi,
            'x': self.x
        })

        return self.createEvent('ok', 'Sine wave', val)
beregning.py 文件源码 项目:python-klmast 作者: staspika 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def _torsjonsvinkel(mast, j, fh, sign):
    """Beregner torsjonsvinkel i kontakttrådhøyde grunnet en eksentrisk horisontal last.

    Funksjonen beregner torsjonsvinkel i grader basert på følgende bjelkeformel:
    :math:`\\phi = \\frac{T}{2EC_w\\lambda}
    [\\frac{sinh(\\lambda(x-fh))-sinh(\\lambda x)}{cosh(\\lambda x)} + \\lambda*fh],
    \\ \\lambda = \\sqrt{\\frac{GI_T}{EC_w}}`

    :param Mast mast: Aktuell mast som beregnes
    :param Kraft j: Last som skal påføres ``mast``
    :param float fh: Kontakttrådhøyde :math:`[m]`
    :param float sign: Fortegn for torsjonsmoment
    :return: Matrise med rotasjonsbidrag :math:`[^{\\circ}]`
    :rtype: :class:`numpy.array`
    """

    D = numpy.zeros((5, 8, 3))

    if j.e[0] < 0:

        if j.navn.startswith("Sidekraft: KL"):
            T = (j.f[1] * -j.e[2] + j.f[2] * j.e[1]) * 1000
        else:
            T = sign*(abs(j.f[1] * -j.e[2]) + abs(j.f[2] * j.e[1])) * 1000

        E = mast.E
        G = mast.G
        I_T = mast.It
        C_w = mast.Cw
        lam = math.sqrt(G * I_T / (E * C_w))
        fh = fh * 1000
        x = -j.e[0] * 1000

        D[j.type[1], j.type[0], 2] = (180/math.pi) * T/(E*C_w*lam**3) * ((math.sinh(lam*(x-fh))
                                                 - math.sinh(lam*x))/math.cosh(lam*x) + lam*fh)
    return D
transverse_mercator.py 文件源码 项目:bpy_lambda 作者: bcongdon 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def toGeographic(self, x, y):
        x /= self.radius
        y /= self.radius
        D = y + self.lat_rad
        lon = atan(sinh(x) / cos(D))
        lat = asin(sin(D) / cosh(x))

        lon = self.lon + degrees(lon)
        lat = degrees(lat)
        return lat, lon
diff_bulk.py 文件源码 项目:nanopores 作者: mitschabaude 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def Cn(l):
    alpha = acosh(l/r)
    s = 0.
    for n in range(1, 100):
        n = float(n)
        K = n*(n+1)/(2*n-1)/(2*n+3)
        s += K*((2*sinh((2*n+1)*alpha)+(2*n+1)*sinh(2*alpha))/(4*(sinh((n+.5)*alpha))**2-(2*n+1)**2*(sinh(alpha))**2) - 1)
    return 1./((4./3.)*sinh(alpha)*s)
getmap.py 文件源码 项目:siren 作者: ozsolarwind 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def mercatorToLat(self, mercatorY):
        return(math.degrees(math.atan(math.sinh(mercatorY))))
outfall_rockdesign.py 文件源码 项目:Outfall-Rock-Protection-Design-Tool 作者: FranciscoChaves90 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, Hs,tp,L,z,d):
        self.u = Hs/2 * (g*tp/L) * math.cosh(2*pi*(z+d)/L) / (math.cosh(2*pi*d/L))
        self.w = Hs/2 * (g*tp/L) * math.sinh(2*pi*(z+d)/L) / (math.cosh(2*pi*d/L))
        self.ax = (g*pi*Hs/L) * math.cosh(2*pi*(z+d)/L) / (math.cosh(2*pi*d/L))
        self.az = (g*pi*Hs/L) * math.sinh(2*pi*(z+d)/L) / (math.cosh(2*pi*d/L))
reciprocal.py 文件源码 项目:PyGLM 作者: Zuzu-Typ 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def csch(angle):
    if type(angle) in dtypes:
        return 1. / math.sinh(angle)

    return functor1(csch, angle)
reciprocal.py 文件源码 项目:PyGLM 作者: Zuzu-Typ 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def coth(angle):
    if type(angle) in dtypes:
        return math.cosh(angle) / math.sinh(angle)

    return functor1(coth, angle)
test_functions.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_trig_hyperb_basic():
    for x in (list(range(100)) + list(range(-100,0))):
        t = x / 4.1
        assert cos(mpf(t)).ae(math.cos(t))
        assert sin(mpf(t)).ae(math.sin(t))
        assert tan(mpf(t)).ae(math.tan(t))
        assert cosh(mpf(t)).ae(math.cosh(t))
        assert sinh(mpf(t)).ae(math.sinh(t))
        assert tanh(mpf(t)).ae(math.tanh(t))
    assert sin(1+1j).ae(cmath.sin(1+1j))
    assert sin(-4-3.6j).ae(cmath.sin(-4-3.6j))
    assert cos(1+1j).ae(cmath.cos(1+1j))
    assert cos(-4-3.6j).ae(cmath.cos(-4-3.6j))
test_functions.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_complex_functions():
    for x in (list(range(10)) + list(range(-10,0))):
        for y in (list(range(10)) + list(range(-10,0))):
            z = complex(x, y)/4.3 + 0.01j
            assert exp(mpc(z)).ae(cmath.exp(z))
            assert log(mpc(z)).ae(cmath.log(z))
            assert cos(mpc(z)).ae(cmath.cos(z))
            assert sin(mpc(z)).ae(cmath.sin(z))
            assert tan(mpc(z)).ae(cmath.tan(z))
            assert sinh(mpc(z)).ae(cmath.sinh(z))
            assert cosh(mpc(z)).ae(cmath.cosh(z))
            assert tanh(mpc(z)).ae(cmath.tanh(z))
test_functions.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def test_complex_inverse_functions():
    mp.dps = 15
    iv.dps = 15
    for (z1, z2) in random_complexes(30):
        # apparently cmath uses a different branch, so we
        # can't use it for comparison
        assert sinh(asinh(z1)).ae(z1)
        #
        assert acosh(z1).ae(cmath.acosh(z1))
        assert atanh(z1).ae(cmath.atanh(z1))
        assert atan(z1).ae(cmath.atan(z1))
        # the reason we set a big eps here is that the cmath
        # functions are inaccurate
        assert asin(z1).ae(cmath.asin(z1), rel_eps=1e-12)
        assert acos(z1).ae(cmath.acos(z1), rel_eps=1e-12)
        one = mpf(1)
    for i in range(-9, 10, 3):
        for k in range(-9, 10, 3):
            a = 0.9*j*10**k + 0.8*one*10**i
            b = cos(acos(a))
            assert b.ae(a)
            b = sin(asin(a))
            assert b.ae(a)
    one = mpf(1)
    err = 2*10**-15
    for i in range(-9, 9, 3):
        for k in range(-9, 9, 3):
            a = -0.9*10**k + j*0.8*one*10**i
            b = cosh(acosh(a))
            assert b.ae(a, err)
            b = sinh(asinh(a))
            assert b.ae(a, err)
test_functions.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def test_mpcfun_real_imag():
    mp.dps = 15
    x = mpf(0.3)
    y = mpf(0.4)
    assert exp(mpc(x,0)) == exp(x)
    assert exp(mpc(0,y)) == mpc(cos(y),sin(y))
    assert cos(mpc(x,0)) == cos(x)
    assert sin(mpc(x,0)) == sin(x)
    assert cos(mpc(0,y)) == cosh(y)
    assert sin(mpc(0,y)) == mpc(0,sinh(y))
    assert cospi(mpc(x,0)) == cospi(x)
    assert sinpi(mpc(x,0)) == sinpi(x)
    assert cospi(mpc(0,y)).ae(cosh(pi*y))
    assert sinpi(mpc(0,y)).ae(mpc(0,sinh(pi*y)))
    c, s = cospi_sinpi(mpc(x,0))
    assert c == cospi(x)
    assert s == sinpi(x)
    c, s = cospi_sinpi(mpc(0,y))
    assert c.ae(cosh(pi*y))
    assert s.ae(mpc(0,sinh(pi*y)))
    c, s = cos_sin(mpc(x,0))
    assert c == cos(x)
    assert s == sin(x)
    c, s = cos_sin(mpc(0,y))
    assert c == cosh(y)
    assert s == mpc(0,sinh(y))
test_functions.py 文件源码 项目:twic_close_reading 作者: jarmoza 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_trig_hyperb_basic():
    for x in (list(range(100)) + list(range(-100,0))):
        t = x / 4.1
        assert cos(mpf(t)).ae(math.cos(t))
        assert sin(mpf(t)).ae(math.sin(t))
        assert tan(mpf(t)).ae(math.tan(t))
        assert cosh(mpf(t)).ae(math.cosh(t))
        assert sinh(mpf(t)).ae(math.sinh(t))
        assert tanh(mpf(t)).ae(math.tanh(t))
    assert sin(1+1j).ae(cmath.sin(1+1j))
    assert sin(-4-3.6j).ae(cmath.sin(-4-3.6j))
    assert cos(1+1j).ae(cmath.cos(1+1j))
    assert cos(-4-3.6j).ae(cmath.cos(-4-3.6j))
test_functions.py 文件源码 项目:twic_close_reading 作者: jarmoza 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def test_complex_functions():
    for x in (list(range(10)) + list(range(-10,0))):
        for y in (list(range(10)) + list(range(-10,0))):
            z = complex(x, y)/4.3 + 0.01j
            assert exp(mpc(z)).ae(cmath.exp(z))
            assert log(mpc(z)).ae(cmath.log(z))
            assert cos(mpc(z)).ae(cmath.cos(z))
            assert sin(mpc(z)).ae(cmath.sin(z))
            assert tan(mpc(z)).ae(cmath.tan(z))
            assert sinh(mpc(z)).ae(cmath.sinh(z))
            assert cosh(mpc(z)).ae(cmath.cosh(z))
            assert tanh(mpc(z)).ae(cmath.tanh(z))
test_functions.py 文件源码 项目:twic_close_reading 作者: jarmoza 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def test_complex_inverse_functions():
    mp.dps = 15
    iv.dps = 15
    for (z1, z2) in random_complexes(30):
        # apparently cmath uses a different branch, so we
        # can't use it for comparison
        assert sinh(asinh(z1)).ae(z1)
        #
        assert acosh(z1).ae(cmath.acosh(z1))
        assert atanh(z1).ae(cmath.atanh(z1))
        assert atan(z1).ae(cmath.atan(z1))
        # the reason we set a big eps here is that the cmath
        # functions are inaccurate
        assert asin(z1).ae(cmath.asin(z1), rel_eps=1e-12)
        assert acos(z1).ae(cmath.acos(z1), rel_eps=1e-12)
        one = mpf(1)
    for i in range(-9, 10, 3):
        for k in range(-9, 10, 3):
            a = 0.9*j*10**k + 0.8*one*10**i
            b = cos(acos(a))
            assert b.ae(a)
            b = sin(asin(a))
            assert b.ae(a)
    one = mpf(1)
    err = 2*10**-15
    for i in range(-9, 9, 3):
        for k in range(-9, 9, 3):
            a = -0.9*10**k + j*0.8*one*10**i
            b = cosh(acosh(a))
            assert b.ae(a, err)
            b = sinh(asinh(a))
            assert b.ae(a, err)
test_functions.py 文件源码 项目:twic_close_reading 作者: jarmoza 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def test_mpcfun_real_imag():
    mp.dps = 15
    x = mpf(0.3)
    y = mpf(0.4)
    assert exp(mpc(x,0)) == exp(x)
    assert exp(mpc(0,y)) == mpc(cos(y),sin(y))
    assert cos(mpc(x,0)) == cos(x)
    assert sin(mpc(x,0)) == sin(x)
    assert cos(mpc(0,y)) == cosh(y)
    assert sin(mpc(0,y)) == mpc(0,sinh(y))
    assert cospi(mpc(x,0)) == cospi(x)
    assert sinpi(mpc(x,0)) == sinpi(x)
    assert cospi(mpc(0,y)).ae(cosh(pi*y))
    assert sinpi(mpc(0,y)).ae(mpc(0,sinh(pi*y)))
    c, s = cospi_sinpi(mpc(x,0))
    assert c == cospi(x)
    assert s == sinpi(x)
    c, s = cospi_sinpi(mpc(0,y))
    assert c.ae(cosh(pi*y))
    assert s.ae(mpc(0,sinh(pi*y)))
    c, s = cos_sin(mpc(x,0))
    assert c == cos(x)
    assert s == sin(x)
    c, s = cos_sin(mpc(0,y))
    assert c == cosh(y)
    assert s == mpc(0,sinh(y))
vectors.py 文件源码 项目:scikit-hep 作者: scikit-hep 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setptetaphim(self, pt, eta, phi, m):
        """ Set the transverse momentum, the pseudorapidity, the angle phi and the mass."""
        px, py, pz = pt*cos(phi), pt*sin(phi), pt*sinh(eta)
        self.setpxpypzm(px,py,pz,m)
vectors.py 文件源码 项目:scikit-hep 作者: scikit-hep 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setptetaphie(self, pt, eta, phi, e):
        """ Set the transverse momentum, the pseudorapidity, the angle phi and the energy."""
        px, py, pz = pt*cos(phi), pt*sin(phi), pt*sinh(eta)
        self.setpxpypze(px,py,pz,e)
test_functions.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_trig_hyperb_basic():
    for x in (list(range(100)) + list(range(-100,0))):
        t = x / 4.1
        assert cos(mpf(t)).ae(math.cos(t))
        assert sin(mpf(t)).ae(math.sin(t))
        assert tan(mpf(t)).ae(math.tan(t))
        assert cosh(mpf(t)).ae(math.cosh(t))
        assert sinh(mpf(t)).ae(math.sinh(t))
        assert tanh(mpf(t)).ae(math.tanh(t))
    assert sin(1+1j).ae(cmath.sin(1+1j))
    assert sin(-4-3.6j).ae(cmath.sin(-4-3.6j))
    assert cos(1+1j).ae(cmath.cos(1+1j))
    assert cos(-4-3.6j).ae(cmath.cos(-4-3.6j))
test_functions.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_complex_functions():
    for x in (list(range(10)) + list(range(-10,0))):
        for y in (list(range(10)) + list(range(-10,0))):
            z = complex(x, y)/4.3 + 0.01j
            assert exp(mpc(z)).ae(cmath.exp(z))
            assert log(mpc(z)).ae(cmath.log(z))
            assert cos(mpc(z)).ae(cmath.cos(z))
            assert sin(mpc(z)).ae(cmath.sin(z))
            assert tan(mpc(z)).ae(cmath.tan(z))
            assert sinh(mpc(z)).ae(cmath.sinh(z))
            assert cosh(mpc(z)).ae(cmath.cosh(z))
            assert tanh(mpc(z)).ae(cmath.tanh(z))
test_functions.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_complex_inverse_functions():
    mp.dps = 15
    iv.dps = 15
    for (z1, z2) in random_complexes(30):
        # apparently cmath uses a different branch, so we
        # can't use it for comparison
        assert sinh(asinh(z1)).ae(z1)
        #
        assert acosh(z1).ae(cmath.acosh(z1))
        assert atanh(z1).ae(cmath.atanh(z1))
        assert atan(z1).ae(cmath.atan(z1))
        # the reason we set a big eps here is that the cmath
        # functions are inaccurate
        assert asin(z1).ae(cmath.asin(z1), rel_eps=1e-12)
        assert acos(z1).ae(cmath.acos(z1), rel_eps=1e-12)
        one = mpf(1)
    for i in range(-9, 10, 3):
        for k in range(-9, 10, 3):
            a = 0.9*j*10**k + 0.8*one*10**i
            b = cos(acos(a))
            assert b.ae(a)
            b = sin(asin(a))
            assert b.ae(a)
    one = mpf(1)
    err = 2*10**-15
    for i in range(-9, 9, 3):
        for k in range(-9, 9, 3):
            a = -0.9*10**k + j*0.8*one*10**i
            b = cosh(acosh(a))
            assert b.ae(a, err)
            b = sinh(asinh(a))
            assert b.ae(a, err)
test_functions.py 文件源码 项目:krpcScripts 作者: jwvanderbeck 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def test_mpcfun_real_imag():
    mp.dps = 15
    x = mpf(0.3)
    y = mpf(0.4)
    assert exp(mpc(x,0)) == exp(x)
    assert exp(mpc(0,y)) == mpc(cos(y),sin(y))
    assert cos(mpc(x,0)) == cos(x)
    assert sin(mpc(x,0)) == sin(x)
    assert cos(mpc(0,y)) == cosh(y)
    assert sin(mpc(0,y)) == mpc(0,sinh(y))
    assert cospi(mpc(x,0)) == cospi(x)
    assert sinpi(mpc(x,0)) == sinpi(x)
    assert cospi(mpc(0,y)).ae(cosh(pi*y))
    assert sinpi(mpc(0,y)).ae(mpc(0,sinh(pi*y)))
    c, s = cospi_sinpi(mpc(x,0))
    assert c == cospi(x)
    assert s == sinpi(x)
    c, s = cospi_sinpi(mpc(0,y))
    assert c.ae(cosh(pi*y))
    assert s.ae(mpc(0,sinh(pi*y)))
    c, s = cos_sin(mpc(x,0))
    assert c == cos(x)
    assert s == sin(x)
    c, s = cos_sin(mpc(0,y))
    assert c == cosh(y)
    assert s == mpc(0,sinh(y))
test_math.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def testSinh(self):
        self.assertRaises(TypeError, math.sinh)
        self.ftest('sinh(0)', math.sinh(0), 0)
        self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1)
        self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0)
        self.assertEqual(math.sinh(INF), INF)
        self.assertEqual(math.sinh(NINF), NINF)
        self.assertTrue(math.isnan(math.sinh(NAN)))
test_math.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def testSinh(self):
        self.assertRaises(TypeError, math.sinh)
        self.ftest('sinh(0)', math.sinh(0), 0)
        self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1)
        self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0)
        self.assertEqual(math.sinh(INF), INF)
        self.assertEqual(math.sinh(NINF), NINF)
        self.assertTrue(math.isnan(math.sinh(NAN)))
sparse_vector_class.py 文件源码 项目:NLP.py 作者: PythonOptimizers 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def sinh(a):
    """Elementwise hyperbolic sine."""
    if not isSparseVector(a):
        raise TypeError("Argument must be a SparseVector")
    rv = SparseVector(a.n, {})
    for k in a.values.keys():
        rv.values[k] = math.sinh(a.values[k])
    return rv
test_math.py 文件源码 项目:web_ctp 作者: molebot 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def testSinh(self):
        self.assertRaises(TypeError, math.sinh)
        self.ftest('sinh(0)', math.sinh(0), 0)
        self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1)
        self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0)
        self.assertEqual(math.sinh(INF), INF)
        self.assertEqual(math.sinh(NINF), NINF)
        self.assertTrue(math.isnan(math.sinh(NAN)))
PyTUN.py 文件源码 项目:PyTUN 作者: SJ-Ang 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def S(V_max,E):
    S = math.sinh(((V_max-E)) / (TEMPERATURE*k))
    return S
sugar.py 文件源码 项目:hyper-engine 作者: maxim5 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def sinh(node): return merge([node], math.sinh)
transverse_mercator.py 文件源码 项目:blender-addons 作者: scorpion81 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def toGeographic(self, x, y):
        x /= self.radius
        y /= self.radius
        D = y + self.lat_rad
        lon = atan(sinh(x) / cos(D))
        lat = asin(sin(D) / cosh(x))

        lon = self.lon + degrees(lon)
        lat = degrees(lat)
        return lat, lon
NuclearOperator.py 文件源码 项目:spectroscopy 作者: jgoodknight 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def sinh(self):
        out = copy.copy(self)
        out.surface = np.sinh(out.surface)
        return out


问题


面经


文章

微信
公众号

扫码关注公众号