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


Python math.asinh函数代码示例

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


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

示例1: test_asinh

    def test_asinh(self):
        import math

        self.ftest(math.asinh(0), 0)
        self.ftest(math.asinh(1), 0.88137358701954305)
        self.ftest(math.asinh(-1), -0.88137358701954305)
        assert math.isinf(math.asinh(float("inf")))
开发者ID:GaussDing,项目名称:pypy,代码行数:7,代码来源:test_math.py

示例2: testAsinh

 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:bnmnetp,项目名称:skulpt,代码行数:8,代码来源:test_math.py

示例3: g

def g(p):
  x, y, z = p[0], p[1], abs(p[2])
  return + x*y*z * asinh(z / (sqrt(x**2 + y**2) + eps))                         \
         + y / 6.0 * (3.0 * z**2 - y**2) * asinh(x / (sqrt(y**2 + z**2) + eps)) \
         + x / 6.0 * (3.0 * z**2 - x**2) * asinh(y / (sqrt(x**2 + z**2) + eps)) \
         - z**3 / 6.0 * atan(x*y / (z * sqrt(x**2 + y**2 + z**2) + eps))        \
         - z * y**2 / 2.0 * atan(x*z / (y * sqrt(x**2 + y**2 + z**2) + eps))    \
         - z * x**2 / 2.0 * atan(y*z / (x * sqrt(x**2 + y**2 + z**2) + eps))    \
         - x*y * sqrt(x**2 + y**2 + z**2) / 3.0
开发者ID:micromagnetics,项目名称:70LinesOfNumpy,代码行数:9,代码来源:sp4_simple.py

示例4: tri_angle_side_angle

def tri_angle_side_angle(a1, s, a2):
  """if the sides go [s,X,Y] with angles a1, a2, on either side of s, this 
  function returns X,Y"""
  #find the remaining angle
  S = math.acos(math.sin(a1)*math.sin(a2)*math.cosh(s) - math.cos(a1)*math.cos(a2))
  #use the law of sines to get the other sides
  sin_ratio = math.sinh(s)/math.sin(S)
  X = math.asinh(sin_ratio*math.sin(a1))
  Y = math.asinh(sin_ratio*math.sin(a2))
  return X,Y
开发者ID:aldenwalker,项目名称:shine,代码行数:10,代码来源:hyp.py

示例5: coefRAsientoZapRectangularFlexible

def coefRAsientoZapRectangularFlexible(l,b):
    '''
    coefRAsientoZapRectangularFlexible(l,b):
    Devuelve el coeficiente R de la expresión del asiento
    de una cimentación superficial flexible rectangular de
    acuerdo con el apartado 4.8.1 de la Guia de
    cimentaciones en obras de carretera, figura 4.10 de la página 113
    '''
    retv=b*math.asinh(l/float(b))+l*math.asinh(b/float(l))
    return(retv)
开发者ID:lcpt,项目名称:xc_utils,代码行数:10,代码来源:asientos.py

示例6: acos

def acos(x):
    _acos_special = [
        [3*pi/4+infj, pi+infj, pi+infj, pi-infj, pi-infj, 3*pi/4-infj, nan+infj],
        [pi/2+infj, None, None, None, None, pi/2-infj, nan+nanj],
        [pi/2+infj, None, None, None, None, pi/2-infj, pi/2+nanj],
        [pi/2+infj, None, None, None, None, pi/2-infj, pi/2+nanj],
        [pi/2+infj, None, None, None, None, pi/2-infj, nan+nanj],
        [pi/4+infj, infj, infj, 0.0-infj, 0.0-infj, pi/4-infj, nan+infj],
        [nan+infj, nan+nanj, nan+nanj, nan+nanj, nan+nanj, nan-infj, nan+nanj]
    ]

    z = _make_complex(x)

    if not isfinite(z):
        return _acos_special[_special_type(z.real)][_special_type(z.imag)]

    if abs(z.real) > _LARGE_DOUBLE or abs(z.imag) > _LARGE_DOUBLE:
        if z.real < 0:
            imag = -math.copysign(math.log(math.hypot(z.real/2, z.imag/2)) +
                                  2 * _LOG_2, z.imag)
        else:
            imag = math.copysign(math.log(math.hypot(z.real/2, z.imag/2)) +
                                 2 * _LOG_2, -z.imag)
        return complex(math.atan2(abs(z.imag), z.real), imag)

    s1 = sqrt(complex(1.0 - z.real, -z.imag))
    s2 = sqrt(complex(1.0 + z.real, z.imag))
    return complex(2 * math.atan2(s1.real, s2.real),
                   math.asinh(s2.real*s1.imag - s2.imag*s1.real))
开发者ID:pombredanne,项目名称:ouroboros,代码行数:29,代码来源:cmath.py

示例7: test_acosh

    def test_acosh(self):
        import math

        self.ftest(math.acosh(1), 0)
        self.ftest(math.acosh(2), 1.3169578969248168)
        assert math.isinf(math.asinh(float("inf")))
        raises(ValueError, math.acosh, 0)
开发者ID:GaussDing,项目名称:pypy,代码行数:7,代码来源:test_math.py

示例8: deg2num

def deg2num(x, y, zoom):
    """Convert longitude, latitude to tile numbers."""
    xmerc = math.radians(x)
    ymerc = math.asinh(math.tan(math.radians(y)))
    xtile = int((1 + xmerc/math.pi) / 2 * 2**zoom)
    ytile = int((1 - ymerc/math.pi) / 2 * 2**zoom)
    return xtile, ytile
开发者ID:otsaloma,项目名称:poor-maps,代码行数:7,代码来源:slippy.py

示例9: zetainv

  def zetainv(self, taup, lam):
    psi = math.asinh(taup)
    
    scal = 1.0 / math.hypot(1.0, taup);

    (u, v, flag) = self.zetainv0(psi, lam)
    if flag:
      return [u, v]

    stol2 = self.tolerance2 / max(psi, 1.0)**2.0
    # min iterations = 2, max iterations = 6; mean = 4.0
    trip = 0
    
    for i in range(100):
      (snu, cnu, dnu, ph) = ellipj(u, self.mu)
      (snv, cnv, dnv, ph) = ellipj(v, self.mv)
      (tau1, lam1) =  self.zeta(snu, cnu, dnu, snv, cnv, dnv);
      (du1, dv1) = self.dwdzeta(snu, cnu, dnu, snv, cnv, dnv)
      
      tau1 -= taup;  lam1 -= lam;
      tau1 *= scal;
      delu = tau1 * du1 - lam1 * dv1
      delv = tau1 * dv1 + lam1 * du1
      u -= delu;  v -= delv;
      if trip > 0:
        break;
      delw2 = delu*delu + delv*delv;
      if delw2 < stol2 :
        trip += 1
    return [u, v]
开发者ID:kitzilla,项目名称:qgis-transmerc-plugin,代码行数:30,代码来源:karney_gsl.py

示例10: zeta

 def zeta(self, snu, cnu, dnu, snv, cnv, dnv):
   '''
    Lee 54.17 but write
    atanh(snu * dnv) = asinh(snu * dnv / sqrt(cnu^2 + _mv * snu^2 * snv^2))
    atanh(_e * snu / dnv) =
            asinh(_e * snu / sqrt(_mu * cnu^2 + _mv * cnv^2))
   '''
   d1 = math.sqrt(cnu*cnu + self.mv * (snu*snv)**2.0)
   d2 = math.sqrt(self.mu * cnu*cnu + self.mv * cnv*cnv)
   t1 = snu * dnv
   if d1 != 0.0:
     t1 /= d1
   else: 
     t1 = self.overflow if snu >= 0.0 else -self.overflow
   
   t2 = self.e * snu
   if d2 != 0.0:
     t2 = math.sinh(self.e * math.asinh(t2 / d2))
   else:
     t2 = self.overflow if snu >= 0.0 else -self.overflow
   
   taup = t1 * math.hypot(1.0, t2) - t2 * math.hypot(1.0, t1);
   lam = 0.0
   if d1 != 0.0 and d2 != 0.0:
     lam = math.atan2(dnu*snv, cnu*cnv) - self.e * math.atan2(self.e*cnu*snv, dnu*cnv)
   return [taup, lam]
开发者ID:kitzilla,项目名称:qgis-transmerc-plugin,代码行数:26,代码来源:karney_gsl.py

示例11: hyperbolic_fun_cal

def hyperbolic_fun_cal(inp_val1, opn_type):
     oprn_dic = {
        '1': 'inverse hyperbolic cosine of x', '2':'inverse hyperbolic sine of x',
        '3':' inverse hyperbolic tangent of x', '4':'hyperbolic cosine of x',
        '5':'hyperbolic sine of x', '6':'hyperbolic tangent of x'}
     if int(opn_type) == 1:
         output = math.acosh(float(inp_val1))
         return str(output)
     if int(opn_type) == 2:
         output = math.asinh(float(inp_val1))
         return str(output)
     if int(opn_type) == 3:
         output = math.atanh(float(inp_val1))
         return str(output)
     if int(opn_type) == 4:
         output = math.cosh(float(inp_val1))
         return str(output)
     if int(opn_type) == 5:
         output = math.sinh(float(inp_val1))
         return str(output)
     if int(opn_type) == 6:
         output = math.tanh(float(inp_val1))
         return str(output)
     else:
         return "Invalid Operation"
开发者ID:RajatShukla,项目名称:Test,代码行数:25,代码来源:math_calc.py

示例12: acos

def acos(x):
    """
        Return the arc cosine of x.

        There are two branch cuts: One extends right from 1 along the real axis to ∞, continuous from below.
        The other extends left from -1 along the real axis to -∞, continuous from above.
    """

    ret = _SPECIAL_VALUE(x, _acos_special_values)
    if ret is not None:
        return ret

    if math.fabs(x.real) > _CM_LARGE_DOUBLE or math.fabs(x.imag) > _CM_LARGE_DOUBLE:

        # avoid unnecessary overflow for large arguments
        _real = math.atan2(math.fabs(x.imag), x.real)

        # split into cases to make sure that the branch cut has the
        # correct continuity on systems with unsigned zeros
        if x.real < 0:
            _imag = -math.copysign(math.log(math.hypot(x.real/2., x.imag/2.)) + _M_LN2*2., x.imag);
        else:
            _imag = math.copysign(math.log(math.hypot(x.real/2., x.imag/2.)) + _M_LN2*2., -x.imag);
    else:
        s1 = complex(float(1-x.real), -x.imag)
        s1 = sqrt(s1)
        s2 = complex(1.0+x.real, x.imag)
        s2 = sqrt(s2)
        _real = 2.0*math.atan2(s1.real, s2.real);
        _imag = math.asinh(s2.real*s1.imag - s2.imag*s1.real)

    return complex(_real,_imag)
开发者ID:brython-dev,项目名称:brython,代码行数:32,代码来源:cmath.py

示例13: asinh

def asinh(x):
    _asinh_special = [
        [-inf-1j*pi/4, complex(-float("inf"), -0.0), complex(-float("inf"), -0.0),
            complex(-float("inf"), 0.0), complex(-float("inf"), 0.0), -inf+1j*pi/4, -inf+nanj],
        [-inf-1j*pi/2, None, None, None, None, -inf+1j*pi/2, nan+nanj],
        [-inf-1j*pi/2, None, None, None, None, -inf+1j*pi/2, nan+nanj],
        [inf-1j*pi/2, None, None, None, None, inf+1j*pi/2, nan+nanj],
        [inf-1j*pi/2, None, None, None, None, inf+1j*pi/2, nan+nanj],
        [inf-1j*pi/4, complex(float("inf"), -0.0), complex(float("inf"), -0.0),
            inf, inf, inf+1j*pi/4, inf+nanj],
        [inf+nanj, nan+nanj, complex(float("nan"), -0.0), nan, nan+nanj, inf+nanj, nan+nanj]
    ]

    z = _make_complex(x)

    if not isfinite(z):
        return _asinh_special[_special_type(z.real)][_special_type(z.imag)]

    if abs(z.real) > _LARGE_DOUBLE or abs(z.imag) > _LARGE_DOUBLE:
        if z.imag >= 0:
            real = math.copysign(math.log(math.hypot(z.imag/2, z.real/2)) +
                                 2 * _LOG_2, z.real)
        else:
            real = -math.copysign(math.log(math.hypot(z.imag/2, z.real/2)) +
                                  2 * _LOG_2, -z.real)
        return complex(real, math.atan2(z.imag, abs(z.real)))

    s1 = sqrt(complex(1+z.imag, -z.real))
    s2 = sqrt(complex(1-z.imag, z.real))
    return complex(math.asinh(s1.real*s2.imag-s2.real*s1.imag),
                   math.atan2(z.imag, s1.real*s2.real - s1.imag*s2.imag))
开发者ID:pombredanne,项目名称:ouroboros,代码行数:31,代码来源:cmath.py

示例14: eccentric_anomaly

    def eccentric_anomaly(self, time):
        """Eccentric anomaly at a given time (s)"""
        M = self.mean_anomaly(time)
        e = self.eccentricity

        if e < 1:  # M = E - e sin E
            M %= (2*math.pi)

            # sin(E) = E -> M = (1 - e) E
            if abs(M) < 2**-26:
                return M / (1 - e)

            return analysis.newton_raphson(
                x_0=math.pi,
                f=lambda E: E - e*math.sin(E) - M,
                f_prime=lambda E: 1 - e*math.cos(E),
            )
        else:  # M = e sinh E - E
            # sinh(E) = E -> M = (e - 1) E
            if abs(M) < 2**-26:
                return M / (e - 1)

            return analysis.newton_raphson(
                x_0=math.asinh(M),
                f=lambda E: e*math.sinh(E) - E - M,
                f_prime=lambda E: e*math.cosh(E) - 1,
            )
开发者ID:virajshah,项目名称:spyce,代码行数:27,代码来源:orbit.py

示例15: sinh_effective_mass_errors

    def sinh_effective_mass_errors(self, dt, fast=True, period=None):
        if fast: logging.info("sinh emass computed fast method")

        T = self.period_check(period)

        jkasv = self.jackknife_average_sub_vev()
        jkemass = {}
        for cfg in self.configs:
            asvc = jkasv[cfg]
            emass = {}
            for t in self.times[dt:-dt]:
                if t in self.emass_skip_times:
                    emass[t] = 0.0
                    continue
                try:
                    guess = (1.0 / float(dt))*math.asinh((asvc[t+dt] + asvc[t-dt])/(2.0*asvc[t]))
                    if fast:
                        emass[t] = guess
                    else:
                        emass[t] = newton.newton_sinh_for_m(t,t+dt,asvc, guess, T)
                except ValueError:
                    #logging.debug("invalid argument to log, setting to zero")
                    emass[t] = 0.0
                except ZeroDivisionError:
                    logging.debug("div by zero, setting to zero")
                    emass[t] = 0.0
                except KeyError:
                    logging.error("index out of range")
            jkemass[cfg] = emass
        jkemassobj = configtimeobj.Cfgtimeobj.fromDataDict(jkemass)
        effmass_dt = self.sinh_effective_mass(dt, fast=fast, period=T)
        return {t: jackknife.errorbars(effmass_dt[t], jkemassobj.get(time=t))
                for t in self.times[dt:-dt]}
开发者ID:f4hy,项目名称:effectivemass,代码行数:33,代码来源:correlator.py


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