Python math.sinh() Examples

The following are 30 code examples of math.sinh(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module math , or try the search function .
Example #1
Source File: ScTrigoOp.py    From Sorcar with GNU General Public License v3.0 6 votes vote down vote up
def post_execute(self):
        out = {}
        if (self.inputs["Operation 1"].default_value == "SIN"):
            if (self.inputs["Operation 2"].default_value == "NONE"):
                out["Value"] = math.sin(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "HB"):
                out["Value"] = math.sinh(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "INV"):
                out["Value"] = math.asin(max(min(self.inputs["X"].default_value, 1), -1))
        elif (self.inputs["Operation 1"].default_value == "COS"):
            if (self.inputs["Operation 2"].default_value == "NONE"):
                out["Value"] = math.cos(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "HB"):
                out["Value"] = math.cosh(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "INV"):
                out["Value"] = math.acos(max(min(self.inputs["X"].default_value, 1), -1))
        elif (self.inputs["Operation 1"].default_value == "TAN"):
            if (self.inputs["Operation 2"].default_value == "NONE"):
                out["Value"] = math.tan(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "HB"):
                out["Value"] = math.tanh(self.inputs["X"].default_value)
            elif (self.inputs["Operation 2"].default_value == "INV"):
                out["Value"] = math.atan(self.inputs["X"].default_value)
        return out 
Example #2
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def thetappp(self,z_in):
        t = self.t_k_inpin
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        z = z_in
        theta_tripleprime = (t*(-1 + (l*(m.cosh(z/a)/m.sinh(l/a)))/a))/(G*J*l)

        return theta_tripleprime

#Case 6 - Concentrated Torque at alpha*l with Fixed Ends
#T = Applied Concentrated Torsional Moment, Kip-in
#G = Shear Modulus of Elasticity, Ksi, 11200 for steel
#J = Torsinal Constant of Cross Section, in^4
#l = Span Lenght, in
#a = Torsional Constant
#alpa = load application point/l 
Example #3
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def thetappp(self,z_in):
        T = self.T_k_in
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        alpha = self.alpha
        z = z_in
        if 0 <= z_in <= (alpha*l):
            theta_tripleprime = -((T*m.cosh(z/a)*(m.cosh((l*alpha)/a) - m.sinh((l*alpha)/a)/m.tanh(l/a)))/(G*J*a**2))
        else:
            theta_tripleprime = (T*(m.cosh(z/a)/m.tanh(l/a) - m.sinh(z/a))*m.sinh((l*alpha)/a))/(G*J*a**2)
        return theta_tripleprime       

#Case 4 - Uniformly Distributed Torque with Pinned Ends
#t = Distributed torque, Kip-in / in
#G = Shear Modulus of Elasticity, Ksi, 11200 for steel
#J = Torsinal Constant of Cross Section, in^4
#l = Span Lenght, in
#a = Torsional Constant 
Example #4
Source File: macros.py    From pyth with MIT License 6 votes vote down vote up
def trig(a, b=' '):
    if is_num(a) and isinstance(b, int):

        funcs = [math.sin, math.cos, math.tan,
                 math.asin, math.acos, math.atan,
                 math.degrees, math.radians,
                 math.sinh, math.cosh, math.tanh,
                 math.asinh, math.acosh, math.atanh]

        return funcs[b](a)

    if is_lst(a):
        width = max(len(row) for row in a)
        padded_matrix = [list(row) + (width - len(row)) * [b] for row in a]
        transpose = list(zip(*padded_matrix))
        if all(isinstance(row, str) for row in a) and isinstance(b, str):
            normalizer = ''.join
        else:
            normalizer = list
        norm_trans = [normalizer(padded_row) for padded_row in transpose]
        return norm_trans
    return unknown_types(trig, ".t", a, b) 
Example #5
Source File: tiles2gpkg_parallel.py    From geopackage-python with GNU General Public License v3.0 6 votes vote down vote up
def tile_to_lat_lon(z, x, y):
        """
        Returns the lat/lon coordinates of the bottom-left corner of the input
        tile.

        Inputs:
        z -- zoom level value for input tile
        x -- tile column (longitude) value for input tile
        y -- tile row (latitude) value for input tile
        """
        n = 2.0**z
        lon = x / n * 360.0 - 180.0
        lat_rad = atan(sinh(pi * (2 * y / n - 1)))
        #lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * y / n)))
        lat = degrees(lat_rad)
        return lat, lon 
Example #6
Source File: generator.py    From tensor with MIT License 6 votes vote down vote up
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) 
Example #7
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def thetappp(self,z_in):
        T = self.T_k_in
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        alpha = self.alpha
        H = self.H
        z = z_in
        
        if 0 <= z_in <= (alpha*l):
            theta_tripleprime = -((T*(m.cosh(z/a)/a**2 + ((-1.0 + (1.0 + H)*(m.cosh((l*alpha)/a))/m.tanh(l/a))*m.sinh(z/a))/a**2 - (H*(m.sinh(z/a)/m.sinh(l/a)))/a**2 - (m.sinh(z/a)*m.sinh((l*alpha)/a))/a**2 - (H*m.sinh(z/a)*m.sinh((l*alpha)/a))/a**2))/(G*(1.0 + H)*J))
        else:
            theta_tripleprime = 0
        return theta_tripleprime  
#Test Area 
Example #8
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def thetappp(self,z_in):
        T = self.T_k_in
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        z = z_in
        theta_tripleprime = (-(T*m.cosh(z/a)) + T*m.sinh(z/a)*m.tanh(l/(2*a)))/(G*J*a**2)

        return theta_tripleprime  

#Case 3 - Concentrated Torque at alpha*l with Pinned Ends
#T = Applied Concentrated Torsional Moment, Kip-in
#G = Shear Modulus of Elasticity, Ksi, 11200 for steel
#J = Torsinal Constant of Cross Section, in^4
#l = Span Lenght, in
#a = Torsional Constant
#alpa = load application point/l 
Example #9
Source File: test_math.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #10
Source File: test_math.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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))) 
Example #11
Source File: sugar.py    From hyper-engine with Apache License 2.0 5 votes vote down vote up
def sinh(node): return merge([node], math.sinh) 
Example #12
Source File: TLorentzVector.py    From uproot-methods with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def z(self):
        return self.pt * self.awkward.numpy.sinh(self.eta) 
Example #13
Source File: TLorentzVector.py    From uproot-methods with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def from_ptetaphi(cls, pt, eta, phi, energy):
        out = cls(pt * cls.awkward.numpy.cos(phi),
                  pt * cls.awkward.numpy.sin(phi),
                  pt * cls.awkward.numpy.sinh(eta),
                  energy)
        out._memo_pt = pt
        out._memo_eta = eta
        out._memo_phi = phi
        return out 
Example #14
Source File: TLorentzVector.py    From uproot-methods with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def from_ptetaphi(cls, pt, eta, phi, energy):
        return cls(pt * math.cos(phi),
                   pt * math.sin(phi),
                   pt * math.sinh(eta),
                   energy) 
Example #15
Source File: test_backend_root.py    From oamap with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_transform(self):
        dataset = oamap.backend.root.dataset("tests/samples/mc10events.root", "Events")

        self.assertEqual(repr(dataset[0].Electron[0].pt * math.sinh(dataset[0].Electron[0].eta)), "-17.956890574044056")

        db = oamap.database.InMemoryDatabase.writable(oamap.database.DictBackend())
        db.data.one = dataset.define("pz", lambda x: x.pt * math.sinh(x.eta), at="Electron", numba=False)

        self.assertEqual(repr(db.data.one[0].Electron[0].pz), "-17.956890574044056") 
Example #16
Source File: test_math.py    From android_universal with MIT License 5 votes vote down vote up
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))) 
Example #17
Source File: tile_convert.py    From tiles-to-tiff with MIT License 5 votes vote down vote up
def mercatorToLat(mercatorY):
    return(degrees(atan(sinh(mercatorY)))) 
Example #18
Source File: TLorentzVector.py    From uproot-methods with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def z(self):
        return self._trymemo("z",lambda self: self.pt * self.awkward.numpy.sinh(self.eta)) 
Example #19
Source File: gigrnd.py    From PRScs with MIT License 5 votes vote down vote up
def dpsi(x, alpha, lam):
    f = -alpha*math.sinh(x)-lam*(math.exp(x)-1)
    return f 
Example #20
Source File: test_math.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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))) 
Example #21
Source File: vectors.py    From scikit-hep with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #22
Source File: vectors.py    From scikit-hep with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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) 
Example #23
Source File: MathLib.py    From PyFlow with Apache License 2.0 5 votes vote down vote up
def sinh(x=('FloatPin', 0.0), Result=(REF, ('BoolPin', False))):
        '''Return the hyperbolic sine of `x`.'''
        try:
            Result(True)
            return math.sinh(x)
        except:
            Result(False)
            return -1 
Example #24
Source File: default_gaussian.py    From pennylane with Apache License 2.0 5 votes vote down vote up
def two_mode_squeezing(r, phi):

    """Two-mode squeezing.

    Args:
        r (float): squeezing magnitude
        phi (float): rotation parameter

    Returns:
        array: symplectic transformation matrix
    """
    cp = math.cos(phi)
    sp = math.sin(phi)
    ch = math.cosh(r)
    sh = math.sinh(r)

    S = np.array(
        [
            [ch, cp * sh, 0, sp * sh],
            [cp * sh, ch, sp * sh, 0],
            [0, sp * sh, ch, -cp * sh],
            [sp * sh, 0, -cp * sh, ch],
        ]
    )

    return S 
Example #25
Source File: default_gaussian.py    From pennylane with Apache License 2.0 5 votes vote down vote up
def squeezing(r, phi):
    """Squeezing in the phase space.

    Args:
        r (float): squeezing magnitude
        phi (float): rotation parameter

    Returns:
        array: symplectic transformation matrix
    """
    cp = math.cos(phi)
    sp = math.sin(phi)
    ch = math.cosh(r)
    sh = math.sinh(r)
    return np.array([[ch - cp * sh, -sp * sh], [-sp * sh, ch + cp * sh]]) 
Example #26
Source File: cv.py    From pennylane with Apache License 2.0 5 votes vote down vote up
def _heisenberg_rep(p):
        R = _rotation(p[1], bare=True)

        S = math.sinh(p[0]) * np.diag([1, -1])
        U = math.cosh(p[0]) * np.identity(5)

        U[0, 0] = 1
        U[1:3, 3:5] = S @ R.T
        U[3:5, 1:3] = S @ R.T
        return U 
Example #27
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def thetapp(self,z_in):
        T = self.T_k_in
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        alpha = self.alpha
        H = self.H
        z = z_in
        
        if 0 <= z_in <= (alpha*l):
            theta_doubleprime = -((T*((m.cosh(z/a)*(-1.0 + (1.0 + H)*(m.cosh((l*alpha)/a))/m.tanh(l/a)))/a - (H*(m.cosh(z/a)/m.sinh(l/a)))/a + m.sinh(z/a)/a - (m.cosh(z/a)*m.sinh((l*alpha)/a))/a - (H*m.cosh(z/a)*m.sinh((l*alpha)/a))/a))/(G*(1.0 + H)*J))
        else:
            theta_doubleprime = 0
        return theta_doubleprime 
Example #28
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def thetap(self,z_in):
        T = self.T_k_in
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        alpha = self.alpha
        H = self.H
        z = z_in
        
        if 0 <= z_in <= (alpha*l):
            theta_prime = (-1.0*T*(-1.0 + m.cosh(z/a) + (-1.0 + (1.0 + H)*m.cosh((l*alpha)/a))*(m.sinh(z/a)/m.tanh(l/a)) - 1.0*H*(m.sinh(z/a)/m.sinh(l/a)) - 1.0*m.sinh(z/a)*m.sinh((l*alpha)/a) - 1.0*H*m.sinh(z/a)*m.sinh((l*alpha)/a)))/(G*(1.0 + H)*J)
        else:
            theta_prime = 0
        return theta_prime 
Example #29
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, T_k_in, G_ksi, J_in4, l_in, a, alpha):
        self.T_k_in = T_k_in
        self.G_ksi = G_ksi 
        self.J_in4 = J_in4
        self.l_in = l_in
        self.a = a
        self.alpha = alpha
        self.H = (((1.0-m.cosh((alpha*l)/a)) / m.tanh(l/a)) + ((m.cosh((alpha*l)/a)-1.0) / m.sinh(l/a)) + m.sinh((alpha*l)/a) - ((alpha*l)/a)) / \
                    (((m.cosh(l/a)+(m.cosh((alpha*l)/a)*m.cosh(l/a))-m.cosh((alpha*l)/a)-1.0)/m.sinh(l/a))+((l/a)*(alpha-1.0))-m.sinh((alpha*l)/a)) 
Example #30
Source File: torsion.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def thetapp(self,z_in):
        t = self.t_k_inpin
        G = self.G_ksi
        J = self.J_in4
        l = self.l_in
        a = self.a
        z = z_in
        theta_doubleprime = (t*(-1.0*z + l*(m.sinh(z/a)/m.sinh(l/a))))/(G*J*l)

        return theta_doubleprime