• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python math.acosh函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: test_funcs_multi

  def test_funcs_multi(self):
    pi = math.pi

    # sin family
    self.assertQuantity(data.sin(Quantity( (0,pi/2), (2,2))), (0,1), (2,0)) 
    self.assertQuantity(data.sinh(Quantity((0,1), (2,2))), (0, math.sinh(1)), (2, math.cosh(1)*2)) 
    self.assertQuantity(data.asin(Quantity((0,0.5), (2,2))), (0,math.asin(0.5)), (2,2/math.sqrt(1-0.5**2))) 
    self.assertQuantity(data.asinh(Quantity((0,1), (2,2))), (0,math.asinh(1)), (2,2/math.sqrt(1+1**2))) 

    # cos family
    self.assertQuantity(data.cos(Quantity((0,pi/2), (2,2))), (1,0), (0,-2)) 
    self.assertQuantity(data.cosh(Quantity((0,1), (2,2))), (1,math.cosh(1)), (0,math.sinh(1)*2)) 
    self.assertQuantity(data.acos(Quantity((0,0.5), (2,2))), (math.acos(0),math.acos(0.5)), (-2,-2/math.sqrt(1-0.5**2)))
    self.assertQuantity(data.acosh(Quantity((2,3), (2,2))), (math.acosh(2), math.acosh(3)), (2/math.sqrt(2**2-1),2/math.sqrt(3**2-1)))

    # tan family
    self.assertQuantity(data.tan(Quantity((0,1), (2,2))), (0,math.tan(1)), (2,2/math.cos(1)**2))
    self.assertQuantity(data.tanh(Quantity((0,1), (2,2))), (0,math.tanh(1)), (2,2/math.cosh(1)**2)) 
    self.assertQuantity(data.atan(Quantity((0,1), (2,2))), (0, math.atan(1)), (2,2/(1+1**2))) 
    self.assertQuantity(data.atan2(Quantity((0,1), (2,2)), Quantity((1,1), (0,0))), (0,math.atan(1)), (2,2/(1+1**2))) 
    self.assertQuantity(data.atanh(Quantity((0,0.5), (2,2))), (0,math.atanh(0.5)), (2,2/(1-0.5**2)))

    #misc
    self.assertQuantity(data.sqrt(Quantity((1,4), (2,2))), (1,2), (1,1/2))
    self.assertQuantity(data.exp(Quantity((1,4), (2,2))), (math.e, math.e**4), (2 * math.e,2*math.e**4))
    self.assertQuantity(data.log(Quantity((1,4), (2,2))), (0, math.log(4)), (2,1/2))
开发者ID:esel7353,项目名称:ephys,代码行数:26,代码来源:data.py


示例3: cheb

def cheb(f,n,e):
    if abs(f)<1:
        t=math.cos(float(n)*math.acos(float(f)))
    elif f>=1:
        t=math.cosh(float(n)*math.acosh(float(f)))
    elif f<=-1:
       t=-1**n*math.cosh(float(n)*math.acosh(float(-f)))
    return 1.0/(float(float(1.0+float(e**2)*float(t**2)))**.5)
开发者ID:alexjgriffith,项目名称:ecg_compression,代码行数:8,代码来源:filters_2.py


示例4: testAcosh

 def testAcosh(self):
     self.assertRaises(TypeError, math.acosh)
     self.ftest('acosh(1)', math.acosh(1), 0)
     self.ftest('acosh(2)', math.acosh(2), 1.3169578969248168)
     self.assertRaises(ValueError, math.acosh, 0)
     self.assertRaises(ValueError, math.acosh, -1)
     self.assertEquals(math.acosh(INF), INF)
     self.assertRaises(ValueError, math.acosh, NINF)
     self.assert_(math.isnan(math.acosh(NAN)))
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:9,代码来源:test_math.py


示例5: hexagon_sides

def hexagon_sides(a, b, c):
    cosha, coshb, coshc = map(math.cosh, [a, b, c])
    sinha, sinhb, sinhc = map(math.sinh, [a, b, c])
    sides = [a,
             math.acosh((cosha * coshb + coshc) / (sinha * sinhb)),
             b,
             math.acosh((coshb * coshc + cosha) / (sinhb * sinhc)),
             c,
             math.acosh((coshc * cosha + coshb) / (sinhc * sinha))]
    return sides
开发者ID:giomasce,项目名称:hyperbolic,代码行数:10,代码来源:teichmuller.py


示例6: __init__

 def __init__(self, S, a, metal, dielec):
     '''\n
     S: center-to-center conductor separation, [unit: m]\n
     a: conductor radius, [unit: m]\n
     metal: conductor material, [unit: material]\n
     dielec: dielectric material between conductors, [unit: material]'''        
     
     self.S = S
     self.a = a
     self.sigma = cond(metal)
     self.eps = dielec_const(dielec)
     self.mu  = 1*spc.mu_0 # mu_r = 1
     self.L   = self.mu*math.acosh(S/(2*a))/math.pi
     self.C = math.pi*self.eps.real/math.acosh(S/(2*a))
开发者ID:l-smith,项目名称:microwave,代码行数:14,代码来源:wg.py


示例7: 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


示例8: cosh_const_effective_mass_errors

    def cosh_const_effective_mass_errors(self, dt):

        jkasv = self.jackknife_average_sub_vev()
        jkemass = {}
        for cfg in self.configs:
            asvc = jkasv[cfg]
            emass = {}
            asvct = {t: asvc[t+dt] - asvc[t] for t in self.times[:-dt]}
            for t in self.times[dt:-(dt+1)]:
                if t in self.emass_skip_times:
                    emass[t] = 0.0
                    continue
                try:
                    emass[t] = (1.0 / float(dt))*math.acosh((asvc[t+dt] + asvc[t-dt])/(2.0*asvc[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.cosh_const_effective_mass(dt)
        return {t: jackknife.errorbars(effmass_dt[t], jkemassobj.get(time=t))
                for t in self.times[dt:-(dt+dt)]}
开发者ID:f4hy,项目名称:effectivemass,代码行数:27,代码来源:correlator.py


示例9: cosh_effective_mass_errors

    def cosh_effective_mass_errors(self, dt, fast=True, period=None):
        if fast: logging.info("cosh emass computed fast method")
        period = self.period
        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.acosh((asvc[t+dt] + asvc[t-dt])/(2.0*asvc[t]))
                    if fast:
                        emass[t] = guess
                    else:
                        emass[t] = newton.newton_cosh_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.cosh_effective_mass(dt, fast=fast, period=period)
        return {t: jackknife.errorbars(effmass_dt[t], jkemassobj.get(time=t))
                for t in self.times[dt:-dt]}
开发者ID:f4hy,项目名称:effectivemass,代码行数:34,代码来源:correlator.py


示例10: compute

    def compute(self, plug, data):

        #   Check if output value is connected
        if plug == self.aOutputVaue:

            #    Get input datas
            operationTypeHandle = data.inputValue(self.aOperationType)
            operationType = operationTypeHandle.asInt()

            inputValueHandle = data.inputValue(self.aInputValue)
            inputValue = inputValueHandle.asFloat()

            #   Math Cosinus
            outputValue = 0
            if operationType == 0:
                outputValue = math.acos(inputValue)
            if operationType == 1:
                outputValue = math.cos(inputValue)
            if operationType == 2:
                outputValue = math.acosh(inputValue)
            if operationType == 3:
                outputValue = math.cosh(inputValue)

            #   Output Value
            output_data = data.outputValue(self.aOutputVaue)
            output_data.setFloat(outputValue)

        #   Clean plug
        data.setClean(plug)
开发者ID:AtonLerin,项目名称:Maya_Tools,代码行数:29,代码来源:QDCos.py


示例11: cosh_effective_mass

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

        T = self.period_check(period)
        asv = self.average_sub_vev()
        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.acosh((asv[t+dt] + asv[t-dt])/(2.0*asv[t]))
                if fast:
                    emass[t] = guess
                else:
                    emass[t] = newton.newton_cosh_for_m(t,t+dt,asv, guess, T)
            except ValueError:
                logging.debug("invalid argument to acosh, setting to zero")
                emass[t] = float('NaN')
            except KeyError:
                logging.error("index out of range")
            except ZeroDivisionError:
                logging.error("Div by zero either dt:{} or average value sub vev {}".format(dt,asv[t]))
                emass[t] = float('NaN')
        return emass
开发者ID:f4hy,项目名称:effectivemass,代码行数:25,代码来源:correlator.py


示例12: pmuboost3d

def pmuboost3d(jets, met, lep):
    mw = 80.385
    wwwtlv = ROOT.TLorentzVector(1e-9,1e-9,1e-9,1e-9)
    mettlv = ROOT.TLorentzVector(1e-9,1e-9,1e-9,1e-9)
    leptlv = ROOT.TLorentzVector(1e-9,1e-9,1e-9,1e-9)
    for jet in jets:
#        if(e.jetPt[ij] > 30.):
            tlvaux = ROOT.TLorentzVector(1e-9,1e-9,1e-9,1e-9)
            tlvaux.SetPtEtaPhiM(jet['pt'],0.,jet['phi'],0.)
            wwwtlv -= tlvaux
    mettlv.SetPtEtaPhiM(met['pt'],0.,met['phi'],0.)
    leptlv.SetPtEtaPhiM(lep['pt'],lep['eta'],lep['phi'], 0.)
#    leptlv.SetPtEtaPhiM(e.muPt[0],e.muEta[0],e.muPhi[0],0.)
# calculate eta(W) estimate; take the + solution
    ptl = (wwwtlv - mettlv).Pt()
    ptn = mettlv.Pt()
    ptw = wwwtlv.Pt()
    etal = leptlv.Eta()
    A = (mw*mw + ptw*ptw - ptl*ptl - ptn*ptn) / (2.*ptl*ptn)
    if(A<1.): A=1.
    etaw = asinh((ptl*sinh(etal)+ptn*sinh(etal+acosh(A)))/ptw)
    if(abs(etaw)>10.): etaw=10*etaw/abs(etaw) # avoid too large values
    wwwtlv.SetPtEtaPhiM(wwwtlv.Pt(),etaw,wwwtlv.Phi(),mw)
# calulate boosted lepton momentum
    beta = wwwtlv.BoostVector()
    leptlv.Boost(-beta)
    return leptlv.P()
开发者ID:HephySusySW,项目名称:Workspace,代码行数:27,代码来源:monoJetFuncs.py


示例13: test_arccosh

    def test_arccosh(self):
        import math
        from _numpypy import arccosh

        for v in [1.0, 1.1, 2]:
            assert math.acosh(v) == arccosh(v)
        for v in [-1.0, 0, .99]:
            assert math.isnan(arccosh(v))
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:8,代码来源:test_ufuncs.py


示例14: acosh

def acosh(space, d):
    """ acosh - Inverse hyperbolic cosine """
    try:
        return space.wrap(math.acosh(d))
    except OverflowError:
        return space.wrap(rfloat.INFINITY)
    except ValueError:
        return space.wrap(rfloat.NAN)
开发者ID:CodeOps,项目名称:hippyvm,代码行数:8,代码来源:funcs.py


示例15: chebyParam

def chebyParam(n, r):
    n = float(n)
    r = float(r)
    iterator = math.cosh(1 / n * math.acosh(r))
    a = ((iterator - 1) / 2).real
    b = ((iterator + 1) / 2).real
    # returns the list of chebyshev's parameters
    return [a, b]
开发者ID:ObadaAlexandru,项目名称:AntennaProject,代码行数:8,代码来源:antenna_package.py


示例16: startingTime

 def startingTime(self):
     angle = self.launchAngle
     F = math.acosh((self.e+math.cos(angle))/(1.0+self.e*math.cos(angle)))
     M = self.e*math.sinh(F)-F
     ht = pow(pow(self.apoapsis,3.0)/self.gm, .5) * M
     if angle>0:
         return -ht
     else:
         return ht
开发者ID:michaelkessler,项目名称:pyorbit,代码行数:9,代码来源:__init__.py


示例17: check_rapidity_allowed

def check_rapidity_allowed(S123,PperpSquared,y):
	"""A function to check if the rapidity is in the allowed region of phase space."""
	##Using equation 49 of Initial-state showering based on colour dipoles connected to incoming parton lines.
	assert (type(S123) == float)
	assert (type(PperpSquared) == float)
	assert (type(y) == float)
	__yMagMax = math.acosh(math.sqrt(S123/PperpSquared)/2.0)
	if (abs(y) > __yMagMax):
		return False
	else:
		return True
开发者ID:leinadao,项目名称:PyShower,代码行数:11,代码来源:sudakovs.py


示例18: chebyParamOptimized

def chebyParamOptimized(n, r, k0):
    n = float(n)
    r = float(r)
    iterator = math.cosh(1 / n * math.acosh(r))
    a = ((iterator - 1) / 2).real
    b = ((iterator + 1) / 2).real
    optimized_dist = (2 * math.pi - math.acos((1 - a) / b)) / k0
    output = open("valori_a_b.txt", "a")
    output.write(" a = " + str(a) + " b = " + str(b) + "  N = " + str(n * 2 + 1) + "\n")
    output.close()
    print("N=" + str(n * 2 + 1) + "  d=" + str(optimized_dist))
    return [a, b, optimized_dist]
开发者ID:ObadaAlexandru,项目名称:AntennaProject,代码行数:12,代码来源:antenna_package.py


示例19: st_acosh

def st_acosh(x):
    """Inverse hyperbolic cosine function.
    
    Parameters
    ----------
    x : float, int, MissingValue instance, or None
    
    Returns
    -------
    Inverse hyperbolic cosine when x is non-missing and x >= 1,
    MISSING (".") otherwise
    
    """
    if isinstance(x, StataVarVals):
        return StataVarVals([
            mv if _is_missing(v) or v < 1
            else math.acosh(v) for v in x.values
        ])
    if _is_missing(x) or x < 1:
        return mv
    return math.acosh(x)
开发者ID:SongLe77,项目名称:stata-dta-in-python,代码行数:21,代码来源:stata_math.py


示例20: acosh

    def acosh(self):
        '''
        Method to perform element-wise inverse hyperbolic cosine in radians
        on the vector.

        @return: result vector as a list.
        '''
        try:
            values = [math.acosh(x) for x in self.values]
        except:
            raise VectorError('Failure in Vector.acosh()')
        self.values = values
        return self.values
开发者ID:bfgoh,项目名称:copads,代码行数:13,代码来源:matrix.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python math.asin函数代码示例发布时间:2022-05-27
下一篇:
Python math.acos函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap