當前位置: 首頁>>代碼示例>>Python>>正文


Python math.cosh方法代碼示例

本文整理匯總了Python中math.cosh方法的典型用法代碼示例。如果您正苦於以下問題:Python math.cosh方法的具體用法?Python math.cosh怎麽用?Python math.cosh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在math的用法示例。


在下文中一共展示了math.cosh方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: trig

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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) 
開發者ID:isaacg1,項目名稱:pyth,代碼行數:24,代碼來源:macros.py

示例2: get

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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) 
開發者ID:calston,項目名稱:tensor,代碼行數:26,代碼來源:generator.py

示例3: thetappp

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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 
開發者ID:buddyd16,項目名稱:Structural-Engineering,代碼行數:20,代碼來源:torsion.py

示例4: post_execute

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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 
開發者ID:aachman98,項目名稱:Sorcar,代碼行數:26,代碼來源:ScTrigoOp.py

示例5: genpy

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def genpy(self, paramTypes, args, pos):
        return "math.cosh({0})".format(*args) 
開發者ID:modelop,項目名稱:hadrian,代碼行數:4,代碼來源:pfamath.py

示例6: __call__

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def __call__(self, state, scope, pos, paramTypes, x):
        return math.cosh(x) 
開發者ID:modelop,項目名稱:hadrian,代碼行數:4,代碼來源:pfamath.py

示例7: compute_hyperbolic_area

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def compute_hyperbolic_area(radius):
    beta = 1.00
    return 2 * math.pi * (math.cosh(radius / K) - 1.0) * beta 
開發者ID:buzzfeed,項目名稱:pyh3,代碼行數:5,代碼來源:h3math.py

示例8: testCosh

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def testCosh(self):
        self.assertRaises(TypeError, math.cosh)
        self.ftest('cosh(0)', math.cosh(0), 1)
        self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert
        self.assertEqual(math.cosh(INF), INF)
        self.assertEqual(math.cosh(NINF), INF)
        self.assertTrue(math.isnan(math.cosh(NAN))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_math.py

示例9: testSinh

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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))) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_math.py

示例10: __init__

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def __init__(self):
        super().__init__()
        self.value = 'cosh' 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:5,代碼來源:hyperbolic.py

示例11: calculate

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def calculate(self, val):
        return self.coefficient * ((math.cosh(val))**self.power) 
開發者ID:aerospaceresearch,項目名稱:visma,代碼行數:4,代碼來源:hyperbolic.py

示例12: __call__

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def __call__(self, val):
        return __inline_fora(
            """fun(@unnamed_args:(val), *args) {
                   PyFloat(math.cosh(val.@m))
                   }"""
            )(val) 
開發者ID:ufora,項目名稱:ufora,代碼行數:8,代碼來源:pure_math.py

示例13: test_pure_python_math_module

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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)) 
開發者ID:ufora,項目名稱:ufora,代碼行數:29,代碼來源:MathTestCases.py

示例14: toGeographic

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
def toGeographic(self, x, y):
        x = x/(self.k * self.radius)
        y = y/(self.k * self.radius)
        D = y + self.latInRadians
        lon = math.atan(math.sinh(x)/math.cos(D))
        lat = math.asin(math.sin(D)/math.cosh(x))

        lon = self.lon + math.degrees(lon)
        lat = math.degrees(lat)
        return (lat, lon) 
開發者ID:vvoovv,項目名稱:blender-terrain,代碼行數:12,代碼來源:transverse_mercator.py

示例15: make_instance

# 需要導入模塊: import math [as 別名]
# 或者: from math import cosh [as 別名]
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 
開發者ID:billpmurphy,項目名稱:hask,代碼行數:11,代碼來源:Num.py


注:本文中的math.cosh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。