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 Project: pyth   Author: isaacg1   File: macros.py    License: 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 #2
Source Project: tensor   Author: calston   File: generator.py    License: 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 #3
Source Project: Structural-Engineering   Author: buddyd16   File: torsion.py    License: 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 #4
Source Project: Structural-Engineering   Author: buddyd16   File: torsion.py    License: 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 #5
Source Project: Structural-Engineering   Author: buddyd16   File: torsion.py    License: 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 #6
Source Project: Structural-Engineering   Author: buddyd16   File: torsion.py    License: 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 #7
Source Project: geopackage-python   Author: GitHubRGI   File: tiles2gpkg_parallel.py    License: 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 #8
Source Project: Sorcar   Author: aachman98   File: ScTrigoOp.py    License: 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 #9
Source Project: hadrian   Author: modelop   File: pfamath.py    License: Apache License 2.0 5 votes vote down vote up
def genpy(self, paramTypes, args, pos):
        return "math.sinh({0})".format(*args) 
Example #10
Source Project: hadrian   Author: modelop   File: pfamath.py    License: Apache License 2.0 5 votes vote down vote up
def __call__(self, state, scope, pos, paramTypes, x):
        return math.sinh(x) 
Example #11
Source Project: pyh3   Author: buzzfeed   File: h3math.py    License: MIT License 5 votes vote down vote up
def compute_delta_theta(r, rp, phi):
    return math.atan(math.tanh(r / K) /
                     (math.sinh(rp / K) * math.sinh(phi))) 
Example #12
Source Project: pyh3   Author: buzzfeed   File: h3math.py    License: MIT License 5 votes vote down vote up
def compute_delta_phi(r, rp):
    return math.atan(math.tanh(r / K) / math.sinh(rp / K)) 
Example #13
Source Project: ironpython2   Author: IronLanguages   File: test_math.py    License: Apache License 2.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 #14
Source Project: visma   Author: aerospaceresearch   File: hyperbolic.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.value = 'sinh' 
Example #15
Source Project: visma   Author: aerospaceresearch   File: hyperbolic.py    License: GNU General Public License v3.0 5 votes vote down vote up
def calculate(self, val):
        return self.coefficient * ((math.sinh(val))**self.power) 
Example #16
Source Project: BinderFilter   Author: dxwu   File: test_math.py    License: 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 Project: oss-ftp   Author: aliyun   File: test_math.py    License: 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 #18
Source Project: fastats   Author: fastats   File: test_convert_to_jit.py    License: MIT License 5 votes vote down vote up
def test_does_not_convert_math_builtins():
    for func in (math.atan2, math.atanh, math.degrees, math.exp, math.floor, math.log,
                 math.sin, math.sinh, math.tan, math.tanh):
        assert convert_to_jit(func) is func 
Example #19
Source Project: pyroutelib3   Author: MKuranowski   File: pyroutelib3.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _marcToLat(x):
    return math.degrees(math.atan(math.sinh(x))) 
Example #20
Source Project: ufora   Author: ufora   File: pure_math.py    License: Apache License 2.0 5 votes vote down vote up
def __call__(self, val):
        return __inline_fora(
            """fun(@unnamed_args:(val), *args) {
                   PyFloat(math.sinh(val.@m))
                   }"""
            )(val) 
Example #21
Source Project: ufora   Author: ufora   File: MathTestCases.py    License: Apache License 2.0 5 votes vote down vote up
def test_pure_python_math_module(self):
        vals = [1, -.5, 1.5, 0, 0.0, -2, -2.2, .2]

        # not being tested: math.asinh, math.atanh, math.lgamma, math.erfc, math.acos
        def f():
            functions = [
                math.sqrt, math.cos, math.sin, math.tan, math.asin, math.atan,
                math.acosh, math.cosh, math.sinh, math.tanh, math.ceil,
                math.erf, math.exp, math.expm1, math.factorial, math.floor,
                math.log, math.log10, math.log1p
            ]
            tr = []
            for idx1 in range(len(vals)):
                v1 = vals[idx1]
                for funIdx in range(len(functions)):
                    function = functions[funIdx]
                    try:
                        tr = tr + [function(v1)]
                    except ValueError as ex:
                        pass

            return tr

        r1 = self.evaluateWithExecutor(f)
        r2 = f()
        self.assertGreater(len(r1), 100)
        self.assertTrue(numpy.allclose(r1, r2, 1e-6)) 
Example #22
Source Project: hask   Author: billpmurphy   File: Num.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def make_instance(typeclass, cls, pi, exp, sqrt, log, pow, logBase, sin,
            tan, cos, asin, atan, acos, sinh, tanh, cosh, asinh, atanh, acosh):
        attrs = {"pi":pi, "exp":exp, "sqrt":sqrt, "log":log, "pow":pow,
                "logBase":logBase, "sin":sin, "tan":tan, "cos":cos,
                "asin":asin, "atan":atan, "acos":acos, "sinh":sinh,
                "tanh":tanh, "cosh":cosh, "asinh":asinh, "atanh":atanh,
                "acosh":acosh}
        build_instance(Floating, cls, attrs)
        return 
Example #23
Source Project: hask   Author: billpmurphy   File: Num.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def sinh(x):
    """
    sinh :: Floating a => a -> a
    """
    return Floating[x].sinh(x) 
Example #24
Source Project: Fluid-Designer   Author: Microvellum   File: test_math.py    License: 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 #25
Source Project: Fluid-Designer   Author: Microvellum   File: shaders.py    License: GNU General Public License v3.0 5 votes vote down vote up
def shade(self, stroke):
        n = len(stroke)
        maxT = min(self._thicknessMax, 0.33 * stroke.length_2d)
        omega = self.omega
        sinhyp = sinh(omega)
        for i, svert in enumerate(stroke):
            c = i / n
            if i < (n * 0.5):
                t = sin((1-c) * omega) / sinhyp * self._thicknessMin + sin(c * omega) / sinhyp * maxT
            else:
                t = sin((1-c) * omega) / sinhyp * maxT + sin(c * omega) / sinhyp * self._thicknessMin
            svert.attribute.thickness = (t / 2.0, t / 2.0) 
Example #26
Source Project: Fluid-Designer   Author: Microvellum   File: transverse_mercator.py    License: GNU General Public License v3.0 5 votes vote down vote up
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 
Example #27
Source Project: Fluid-Designer   Author: Microvellum   File: shaders.py    License: GNU General Public License v3.0 5 votes vote down vote up
def shade(self, stroke):
        n = len(stroke)
        maxT = min(self._thicknessMax, 0.33 * stroke.length_2d)
        omega = self.omega
        sinhyp = sinh(omega)
        for i, svert in enumerate(stroke):
            c = i / n
            if i < (n * 0.5):
                t = sin((1-c) * omega) / sinhyp * self._thicknessMin + sin(c * omega) / sinhyp * maxT
            else:
                t = sin((1-c) * omega) / sinhyp * maxT + sin(c * omega) / sinhyp * self._thicknessMin
            svert.attribute.thickness = (t / 2.0, t / 2.0) 
Example #28
Source Project: ironpython3   Author: IronLanguages   File: test_math.py    License: Apache License 2.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 #29
Source Project: madminer   Author: diana-hep   File: various.py    License: MIT License 5 votes vote down vote up
def math_commands():
    """Provides list with math commands - we need this when using eval"""

    from math import acos, asin, atan, atan2, ceil, cos, cosh, exp, floor, log, pi, pow, sin, sinh, sqrt, tan, tanh

    functions = [
        "acos",
        "asin",
        "atan",
        "atan2",
        "ceil",
        "cos",
        "cosh",
        "exp",
        "floor",
        "log",
        "pi",
        "pow",
        "sin",
        "sinh",
        "sqrt",
        "tan",
        "tanh",
    ]

    mathdefinitions = {}
    for f in functions:
        mathdefinitions[f] = locals().get(f, None)

    return mathdefinitions 
Example #30
Source Project: Structural-Engineering   Author: buddyd16   File: torsion.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def theta(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
        
        thet = ((T*a) / (G*J))*((m.tanh(l/(2*a))*m.cosh(z/a))-(m.tanh(l/(2*a)))+(z/a)-(m.sinh(z/a)))
        
        return thet