当前位置: 首页>>代码示例>>Python>>正文


Python math.asinh方法代码示例

本文整理汇总了Python中math.asinh方法的典型用法代码示例。如果您正苦于以下问题:Python math.asinh方法的具体用法?Python math.asinh怎么用?Python math.asinh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在math的用法示例。


在下文中一共展示了math.asinh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_math_subclass

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def test_math_subclass(self):
        """verify subtypes of float/long work w/ math functions"""
        import math
        class myfloat(float): pass
        class mylong(long): pass

        mf = myfloat(1)
        ml = mylong(1)

        for x in math.log, math.log10, math.log1p, math.asinh, math.acosh, math.atanh, math.factorial, math.trunc, math.isinf:
            try:
                resf = x(mf)
            except ValueError:
                resf = None
            try:
                resl = x(ml)
            except ValueError:
                resl = None
            self.assertEqual(resf, resl) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:test_math.py

示例2: trig

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [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

示例3: get

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [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

示例4: geodetic2isometric_point

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def geodetic2isometric_point(geodetic_lat: float, ell: Ellipsoid = None, deg: bool = True) -> float:
    geodetic_lat, ell = sanitize(geodetic_lat, ell, deg)

    e = ell.eccentricity

    if abs(geodetic_lat - pi / 2) <= 1e-9:
        isometric_lat = inf
    elif abs(-geodetic_lat - pi / 2) <= 1e-9:
        isometric_lat = -inf
    else:
        isometric_lat = asinh(tan(geodetic_lat)) - e * atanh(e * sin(geodetic_lat))
        # same results
        # a1 = e * sin(geodetic_lat)
        # y = (1 - a1) / (1 + a1)
        # a2 = pi / 4 + geodetic_lat / 2
        # isometric_lat = log(tan(a2) * (y ** (e / 2)))
        # isometric_lat = log(tan(a2)) + e/2 * log((1-e*sin(geodetic_lat)) / (1+e*sin(geodetic_lat)))

    return degrees(isometric_lat) if deg else isometric_lat 
开发者ID:geospace-code,项目名称:pymap3d,代码行数:21,代码来源:latitude.py

示例5: compute_radius

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def compute_radius(H_p):
    return K * math.asinh(math.sqrt(H_p / (2 * math.pi * K * K))) 
开发者ID:buzzfeed,项目名称:pyh3,代码行数:4,代码来源:h3math.py

示例6: testAsinh

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def testAsinh(self):
        self.assertRaises(TypeError, math.asinh)
        self.ftest('asinh(0)', math.asinh(0), 0)
        self.ftest('asinh(1)', math.asinh(1), 0.88137358701954305)
        self.ftest('asinh(-1)', math.asinh(-1), -0.88137358701954305)
        self.assertEqual(math.asinh(INF), INF)
        self.assertEqual(math.asinh(NINF), NINF)
        self.assertTrue(math.isnan(math.asinh(NAN))) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_math.py

示例7: test_gh1284

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def test_gh1284(self):
        import math
        self.assertEqual(round(math.asinh(4.),12),round(math.log(math.sqrt(17.)+4.),12))
        self.assertEqual(round(math.asinh(.4),12),round(math.log(math.sqrt(1.16)+.4),12))
        self.assertEqual(round(math.asinh(-.5),12),round(math.log(math.sqrt(1.25)-.5),12))
        self.assertEqual(round(math.asinh(-6.),12),round(math.log(math.sqrt(37.)-6.),12)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:test_regressions.py

示例8: testAsinhFunction

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def testAsinhFunction(self):
        ma5 = MovingAverage(5, 'close')
        holder = Asinh(ma5)

        for i, close in enumerate(self.sampleClose):
            data = {'close': close}
            ma5.push(data)
            holder.push(data)

            expected = math.asinh(ma5.result())
            calculated = holder.result()
            self.assertAlmostEqual(calculated, expected, 12, "at index {0:d}\n"
                                                             "expected:   {1:f}\n"
                                                             "calculated: {2:f}".format(i, expected, calculated)) 
开发者ID:alpha-miner,项目名称:Finance-Python,代码行数:16,代码来源:testAccumulatorsArithmetic.py

示例9: __call__

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def __call__(self, val):
        if val < 1.0:
            raise ValueError("math domain error")

        return __inline_fora(
            """fun(@unnamed_args:(val), *args) {
                   PyFloat(math.asinh(val.@m))
                   }"""
            )(val) 
开发者ID:ufora,项目名称:ufora,代码行数:11,代码来源:pure_math.py

示例10: test_pure_python_math_module

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [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

示例11: make_instance

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [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

示例12: asinh

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def asinh(x):
    """
    asinh :: Floating a => a -> a
    """
    return Floating[x].asinh(x) 
开发者ID:billpmurphy,项目名称:hask,代码行数:7,代码来源:Num.py

示例13: ToolFreq2Bark

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def ToolFreq2Bark(fInHz, cModel = 'Schroeder'):
    def acaSchroeder_scalar(f):
        return 7 * math.asinh(f/650)
    def acaTerhardt_scalar(f):
        return 13.3 * math.atan(0.75 * f/1000)
    def acaZwicker_scalar(f):
        return 13 * math.atan(0.76 * f/1000) + 3.5 * math.atan(f/7500)
    def acaTraunmuller_scalar(f):
        return 26.81/(1+1960./f) - 0.53

    f = np.asarray(fInHz)
    if f.ndim == 0:
        if cModel == 'Terhardt':
            return acaTerhardt_scalar(f)
        elif cModel == 'Zwicker':
            return acaZwicker_scalar(f)
        elif cModel == 'Traunmuller':
            return acaTraunmuller_scalar(f)
        else:
            return acaSchroeder_scalar(f)

    fBark = np.zeros(f.shape)
    if cModel == 'Terhardt':
        for k,fi in enumerate(f):
            fBark[k] =  acaTerhardt_scalar(fi)
    elif cModel == 'Zwicker':
        for k,fi in enumerate(f):
            fBark[k] =  acaZwicker_scalar(fi)
    elif cModel == 'Traunmuller':
        for k,fi in enumerate(f):
            fBark[k] =  acaTraunmuller_scalar(fi)
    else:
        for k,fi in enumerate(f):
            fBark[k] =  acaSchroeder_scalar(fi)
            
    return (fBark) 
开发者ID:alexanderlerch,项目名称:pyACA,代码行数:38,代码来源:ToolFreq2Bark.py

示例14: asinh

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def asinh(x=('FloatPin', 0.0)):
        '''Return the inverse hyperbolic sine of x.'''
        return math.asinh(x) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:5,代码来源:MathLib.py

示例15: render

# 需要导入模块: import math [as 别名]
# 或者: from math import asinh [as 别名]
def render(self):
        # Open US map.
        us_map = Image.open(MAP_FILE)
        # Convert latitudes to a linear form.
        self.lat1 = AreaMap.LAT_MAX - math.asinh(math.tan(math.radians(self.lat1)))
        self.lat2 = AreaMap.LAT_MAX - math.asinh(math.tan(math.radians(self.lat2)))
        # Calculate x-coords using a ratio of a known location on the map.
        x1 = (self.lon1 + 130.781250) * 7162 / 39.34135
        x2 = (self.lon2 + 130.781250) * 7162 / 39.34135
        # Use another ratio of a known location to find the latitudes.
        den = AreaMap.LAT_MAX - AreaMap.REF_LAT
        y1 = self.lat1 * 3565 / den
        y2 = self.lat2 * 3565 / den
        # Crop the map.
        cropped = us_map.crop((
            int(x1),
            int(y1),
            int(x2),
            int(y2)
        ))
        # Resize to 900x900, convert to right format, and save.
        self.map = cropped.resize((900, 900))
        self.map = self.map.convert('RGBA')
        name = '{0}.png'.format(self.area_id)
        self.map.save(os.path.join(MAPS, name))

    # Get an area map for the predefined area. 
开发者ID:KYDronePilot,项目名称:hdfm,代码行数:29,代码来源:us_map.py


注:本文中的math.asinh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。