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


Python math.atanh方法代码示例

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


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

示例1: test_math_subclass

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

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
def _get_distorted_indices(self, nb_images):
        inverse = random.randint(0, 1)

        if inverse:
            scale = random.random()
            scale *= 0.21
            scale += 0.6
        else:
            scale = random.random()
            scale *= 0.6
            scale += 0.8

        frames_per_clip = nb_images

        indices = np.linspace(-scale, scale, frames_per_clip).tolist()
        if inverse:
            values = [math.atanh(x) for x in indices]
        else:
            values = [math.tanh(x) for x in indices]

        values = [x / values[-1] for x in values]
        values = [int(round(((x + 1) / 2) * (frames_per_clip - 1), 0)) for x in values]
        return values 
开发者ID:okankop,项目名称:vidaug,代码行数:25,代码来源:temporal.py

示例5: geodetic2isometric_point

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

示例6: tanh_range

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
def tanh_range(l, r, initial=None):

  def get_activation(left, right, initial):

    def activation(x):
      if initial is not None:
        bias = math.atanh(2 * (initial - left) / (right - left) - 1)
      else:
        bias = 0
      return tanh01(x + bias) * (right - left) + left

    return activation

  return get_activation(l, r, initial) 
开发者ID:yuanming-hu,项目名称:exposure,代码行数:16,代码来源:util.py

示例7: testAtanh

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

示例8: test_does_not_convert_math_builtins

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
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 
开发者ID:fastats,项目名称:fastats,代码行数:6,代码来源:test_convert_to_jit.py

示例9: __call__

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

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

示例10: test_pure_python_math_module

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

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

示例13: fromGeographic

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
def fromGeographic(self, lat, lon):
        lat_rad = radians(lat)
        lon_rad = radians(lon)
        B = cos(lat_rad) * sin(lon_rad - self.lon_rad)
        x = self.radius * atanh(B)
        y = self.radius * (atan(tan(lat_rad) / cos(lon_rad - self.lon_rad)) - self.lat_rad)
        return x, y 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:transverse_mercator.py

示例14: atanh

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
def atanh(x=('FloatPin', 0.0), Result=(REF, ('BoolPin', False))):
        '''Return the inverse hyperbolic tangent of `x`.'''
        try:
            Result(True)
            return math.atanh(x)
        except:
            Result(False)
            return -1 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:10,代码来源:MathLib.py

示例15: rz_ci

# 需要导入模块: import math [as 别名]
# 或者: from math import atanh [as 别名]
def rz_ci(r, n, conf_level = 0.95):
    zr_se = pow(1/(n - 3), .5)
    moe = norm.ppf(1 - (1 - conf_level)/float(2)) * zr_se
    zu = atanh(r) + moe
    zl = atanh(r) - moe
    return tanh((zl, zu)) 
开发者ID:MicrosoftResearch,项目名称:Azimuth,代码行数:8,代码来源:corrstats.py


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