本文整理汇总了Python中math.sinh函数的典型用法代码示例。如果您正苦于以下问题:Python sinh函数的具体用法?Python sinh怎么用?Python sinh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sinh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testHyperbolic
def testHyperbolic(self):
self.assertEqual(math.sinh(5), hyperbolic.sineh_op(5))
self.assertEqual(math.cosh(5), hyperbolic.cosineh_op(5))
self.assertEqual(math.tanh(5), hyperbolic.tangenth_op(5))
self.assertEqual(1. / math.sinh(5), hyperbolic.cosecanth_op(5))
self.assertEqual(1. / math.cosh(5), hyperbolic.secanth_op(5))
self.assertEqual(1. / math.tanh(5), hyperbolic.cotangenth_op(5))
开发者ID:Eleanor320,项目名称:pygep,代码行数:7,代码来源:mathematical.py
示例2: heisenT
def heisenT(beta):
# Following notation of Xiang (http://arxiv.org/pdf/1201.1144v4.pdf)
W=np.array([[math.sqrt(math.cosh(beta)), math.sqrt(math.sinh(beta))],
[math.sqrt(math.cosh(beta)), -math.sqrt(math.sinh(beta))]])
#T=np.einsum("au,ad,al,ar->udlr",W,W,W,W)
T=np.einsum("al,ar->lr",W,W)
return T
开发者ID:gkc1000,项目名称:tomato,代码行数:7,代码来源:numpepo.py
示例3: sinh
def sinh(x):
""" Return the hyperbolic sine of x. """
if math.isinf(x.real) or math.isinf(x.imag):
# need to raise DomainError if y is +/- infinity and x is not
# a NaN and not -infinity
if math.isinf(x.imag) and not math.isnan(x.real):
raise ValueError("math domain error")
if math.isinf(x.real) and -_INF < x.imag < _INF and x.imag != .0:
if x.real > 0:
_real = math.copysign(_INF, cos(x.imag))
_imag = math.copysign(_INF, sin(x.imag))
else:
_real = -math.copysign(_INF, cos(x.imag))
_imag = math.copysign(_INF, sin(x.imag))
return complex(_real, _imag)
return _SPECIAL_VALUE(x,_sinh_special_values)
if math.fabs(x.real) > _CM_LOG_LARGE_DOUBLE:
x_minus_one = x.real - math.copysign(1.0, x.real)
_real = math.cos(x.imag)*math.sinh(x.imag)*math.e
_imag = math.sin(x.imag)*math.cosh(x.imag)*math.e
else:
_real = math.cos(x.imag)*math.sinh(x.real)
_imag = math.sin(x.imag)*math.cosh(x.real)
if math.isinf(_real) or math.isinf(_imag):
raise OverflowError()
return complex(_real, _imag)
开发者ID:brython-dev,项目名称:brython,代码行数:32,代码来源:cmath.py
示例4: cosh
def cosh(x):
"""Return the hyperbolic cosine of x."""
# special treatment for cosh(+/-inf + iy) if y is not a NaN
if isinf(x):
if -_INF < x.imag < _INF and x.imag != .0:
if x.real > 0:
_real = math.copysign(_INF, math.cos(x.imag))
_imag = math.copysign(_INF, math.sin(x.imag))
else:
_real = math.copysign(_INF, math.cos(x.imag))
_imag = -math.copysign(_INF, math.sin(x.imag))
return complex(_real,_imag)
else:
# need to raise math domain error if y is +/- infinity and x is not a NaN
if x.imag != .0 and not math.isnan(x.real):
raise ValueError("math domain error")
return _SPECIAL_VALUE(x,_cosh_special_values)
if math.fabs(x.real) > _CM_LOG_LARGE_DOUBLE:
# deal correctly with cases where cosh(x.real) overflows but
# cosh(z) does not.
x_minus_one = x.real - math.copysign(1.0, x.real)
_real = cos(x.imag) * math.cosh(x_minus_one) * math.e
_imag = sin(x.imag) * math.sinh(x_minus_one) * math.e
else:
_real = math.cos(x.imag) * math.cosh(x.real)
_imag = math.sin(x.imag) * math.sinh(x.real)
ret = complex(_real, _imag)
# detect overflow
if isinf(ret):
raise OverflowError()
return ret
开发者ID:brython-dev,项目名称:brython,代码行数:34,代码来源:cmath.py
示例5: laplace_Dirichlet_analytic
def laplace_Dirichlet_analytic(Ttop, x, y):
""" Function that calculates the analytic solution to the laplace heat equation
d^2(T)/dx^2 + d^2(T)/dy^2 = 0
with Dirichlet boundary conditions:
T(x, 0) = 0
T(0, y) = 0 y<1.5
T(1, y) = 0 y<1.5
T(x, 1.5) = Ttop
on a square grid with xmax = 1 and ymax= 1
Args:
Ttop(float): Temperature at top, T(x, 1.5)
x(float): x-coordinate
y(float): y-coordinate
Returns:
T(float): Temperature at T(x, y)
"""
sum = 0
for n in range(1,50, 1):
lambdan = pi*n
An = 2*((-1)**(n+1)+1)/(lambdan*sinh(1.5*lambdan))
term = An*sinh(lambdan*y )*sin(lambdan*x)
sum += term
return Ttop*sum
开发者ID:lrhgit,项目名称:tkt4140,代码行数:31,代码来源:test_solvers.py
示例6: to_wgs84
def to_wgs84(x, y, twd67=False):
'''
The formula is based on
"https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system"
'''
if twd67:
x, y = twd67_to_twd97(x, y)
x /= 1000.0 # m to km
y /= 1000.0 # m to km
xi = (y - N0) / (k0 * A)
eta = (x - E0) / (k0 * A)
xip = (xi -
b1 * math.sin(2 * xi) * math.cosh(2 * eta) -
b2 * math.sin(4 * xi) * math.cosh(4 * eta) -
b3 * math.sin(6 * xi) * math.cosh(6 * eta))
etap = (eta -
b1 * math.cos(2 * xi) * math.sinh(2 * eta) -
b2 * math.cos(4 * xi) * math.sinh(4 * eta) -
b3 * math.cos(6 * xi) * math.sinh(6 * eta))
chi = math.asin(math.sin(xip) / math.cosh(etap))
lat = math.degrees(
chi +
d1 * math.sin(2 * chi) +
d2 * math.sin(4 * chi) +
d3 * math.sin(6 * chi))
lon = lon0 + math.degrees(
math.atan(math.sinh(etap) / math.cos(xip)))
return (lat, lon)
开发者ID:wagamama,项目名称:geo-twd,代码行数:32,代码来源:__init__.py
示例7: c_sinh
def c_sinh(x, y):
# special treatment for sinh(+/-inf + iy) if y is finite and nonzero
if not isfinite(x) or not isfinite(y):
if isinf(x) and isfinite(y) and y != 0.:
if x > 0:
real = copysign(INF, math.cos(y))
imag = copysign(INF, math.sin(y))
else:
real = -copysign(INF, math.cos(y))
imag = copysign(INF, math.sin(y))
r = (real, imag)
else:
r = sinh_special_values[special_type(x)][special_type(y)]
# need to raise ValueError if y is +/- infinity and x is not
# a NaN
if isinf(y) and not isnan(x):
raise ValueError("math domain error")
return r
if fabs(x) > CM_LOG_LARGE_DOUBLE:
x_minus_one = x - copysign(1., x)
real = math.cos(y) * math.sinh(x_minus_one) * math.e
imag = math.sin(y) * math.cosh(x_minus_one) * math.e
else:
real = math.cos(y) * math.sinh(x)
imag = math.sin(y) * math.cosh(x)
if isinf(real) or isinf(imag):
raise OverflowError("math range error")
return real, imag
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:30,代码来源:interp_cmath.py
示例8: exact_fn
def exact_fn ( x ):
#
## EXACT_FN evaluates the exact solution.
#
from math import sinh
value = x - sinh ( x ) / sinh ( 1.0 )
return value
开发者ID:johannesgerer,项目名称:jburkardt-py,代码行数:7,代码来源:fem1d_model.py
示例9: tri_angles
def tri_angles(L):
ans = [0, 0, 0]
for i in xrange(3):
top = math.cosh(L[i])*math.cosh(L[(i+2)%3]) - math.cosh( L[(i+1)%3] )
bottom = math.sinh(L[i])*math.sinh(L[(i+2)%3])
ans[i] = math.acos(top/bottom)
return ans
开发者ID:aldenwalker,项目名称:shine,代码行数:7,代码来源:hyp.py
示例10: 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
示例11: gridToGeodetic
def gridToGeodetic(self, north, east):
"""
Transformation from grid coordinates to geodetic coordinates.
@param north (corresponds to X in RT 90 and N in SWEREF 99.)
@param east (corresponds to Y in RT 90 and E in SWEREF 99.)
@return (latitude, longitude)
"""
if (self._initialized == False):
return None
deg_to_rad = math.pi / 180
lambda_zero = self._central_meridian * deg_to_rad
xi = (north - self._false_northing) / (self._scale * self._a_roof)
eta = (east - self._false_easting) / (self._scale * self._a_roof)
xi_prim = xi - \
self._delta1*math.sin(2.0*xi) * math.cosh(2.0*eta) - \
self._delta2*math.sin(4.0*xi) * math.cosh(4.0*eta) - \
self._delta3*math.sin(6.0*xi) * math.cosh(6.0*eta) - \
self._delta4*math.sin(8.0*xi) * math.cosh(8.0*eta)
eta_prim = eta - \
self._delta1*math.cos(2.0*xi) * math.sinh(2.0*eta) - \
self._delta2*math.cos(4.0*xi) * math.sinh(4.0*eta) - \
self._delta3*math.cos(6.0*xi) * math.sinh(6.0*eta) - \
self._delta4*math.cos(8.0*xi) * math.sinh(8.0*eta)
phi_star = math.asin(math.sin(xi_prim) / math.cosh(eta_prim))
delta_lambda = math.atan(math.sinh(eta_prim) / math.cos(xi_prim))
lon_radian = lambda_zero + delta_lambda
lat_radian = phi_star + math.sin(phi_star) * math.cos(phi_star) * \
(self._Astar + \
self._Bstar*math.pow(math.sin(phi_star), 2) + \
self._Cstar*math.pow(math.sin(phi_star), 4) + \
self._Dstar*math.pow(math.sin(phi_star), 6))
lat = lat_radian * 180.0 / math.pi
lon = lon_radian * 180.0 / math.pi
return (lat, lon)
开发者ID:ybkuang,项目名称:swedish_geoposition_converter,代码行数:35,代码来源:__init__.py
示例12: c_cosh
def c_cosh(x, y):
if not isfinite(x) or not isfinite(y):
if isinf(x) and isfinite(y) and y != 0.:
if x > 0:
real = copysign(INF, math.cos(y))
imag = copysign(INF, math.sin(y))
else:
real = copysign(INF, math.cos(y))
imag = -copysign(INF, math.sin(y))
r = (real, imag)
else:
r = cosh_special_values[special_type(x)][special_type(y)]
# need to raise ValueError if y is +/- infinity and x is not
# a NaN
if isinf(y) and not isnan(x):
raise ValueError("math domain error")
return r
if fabs(x) > CM_LOG_LARGE_DOUBLE:
# deal correctly with cases where cosh(x) overflows but
# cosh(z) does not.
x_minus_one = x - copysign(1., x)
real = math.cos(y) * math.cosh(x_minus_one) * math.e
imag = math.sin(y) * math.sinh(x_minus_one) * math.e
else:
real = math.cos(y) * math.cosh(x)
imag = math.sin(y) * math.sinh(x)
if isinf(real) or isinf(imag):
raise OverflowError("math range error")
return real, imag
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:31,代码来源:interp_cmath.py
示例13: tileGeometry
def tileGeometry(self, x, y, z):
n = 2.0 ** z
xmin = x / n * 360.0 - 180.0
xmax = (x + 1) / n * 360.0 - 180
ymin = math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * y / n))))
ymax = math.degrees(math.atan(math.sinh(math.pi * (1 - 2 * (y + 1) / n))))
return QgsGeometry.fromRect(QgsRectangle(xmin, ymin, xmax, ymax))
开发者ID:cwygoda,项目名称:qgis-tilecover,代码行数:7,代码来源:tilecover.py
示例14: sinh
def sinh(self, other=None):
# Return hiperbolic sine of interval
if other != None:
intv = IReal(self, other)
else:
if type(self) == float or type(self) == str:
intv = IReal(self)
else:
intv = self
if math.sinh(intv.inf) > math.sinh(intv.sup):
inf = max(intv.inf, intv.sup)
sup = min(intv.inf, intv.sup)
else:
inf = intv.inf
sup = intv.sup
ireal.rounding.set_mode(1)
ireal.rounding.set_mode(-1)
ireal.rounding.set_mode(-1)
new_inf = math.sinh(inf)
ireal.rounding.set_mode(1)
new_sup = max(float(IReal('%.16f' % math.sinh(sup)).sup), float(IReal('%.20f' % math.sinh(sup)).sup))
return IReal(new_inf, new_sup)
开发者ID:filipevarjao,项目名称:IntPy,代码行数:29,代码来源:stdfunc.py
示例15: to_latlon
def to_latlon(northings, eastings, altitude):
f = 1/298.257223563
n = f / (2 - f)
n_0 = 0.0
k_0 = 0.9996
e_0 = 500.
a = 6378.137 #km
big_a = (a / (1 + n)) * (1 + (n**2 / 4) + (n**4 / 64)) #approximately
alpha_1 = .5 * n - (2. / 3.) * n**2 + (5. / 16.) * n**3
alpha_2 = (13./48.) * n**2 - (3./5.) * n**3
alpha_3 = (61./240.) * n**3
beta_1 = (1./2.) * n - (2. / 3.) * n**2 + (37./96.) * n**3
beta_2 = (1./48.) * n**2 + (1. / 15.) * n**3
beta_3 = (17. /480.) * n**3
delta_1 = 2. * n - (2./3.) * n**2 - 2* n**3
delta_2 = (7./3.) * n**2 - (8. / 5.) * n**3
delta_3 = (56./15.) * n**3
psi = (n - n_0) / (k_0 * big_a)
eta = (e - e_0) / (k_0 * big_a)
psi_prime = psi - ((beta_1 * sin(2. * 1 * eta) * cosh(2. * 1 * eta)) +
(beta_2 * sin(2. * 2 * eta) * cosh(2. * 2 * eta)) + (beta_3 * sin(2. * 3 * eta) * cosh(2. * 3 * eta)))
eta_prime = eta - ((beta_1 * cos(2. * 1 * psi) * sinh(2. * 1 * eta)) +
(beta_2 * cos(2. * 2 * psi) * sinh(2. * 2 * eta)) + (beta_3 * cos(2. * 3 * psi) * sinh(2. * 3 * eta)))
sigma_prime = 1. - ((2. * 1 * beta_1 * cos(2. * 1 * psi) * cosh(2. * 1 * eta)) +
(2. * 2 * beta_2 * cos(2. * 2 * psi) * cosh(2. * 2 * eta)) + (2. * 3 * beta_3 * cos(2. * 3 * psi) * cosh(2. * 3 * eta)))
tau_prime = ((2. * 1 * beta_1 * sin(2. * 1 * psi) * sinh(2. * 1 * eta)) +
(2. * 2 * beta_2 * sin(2. * 2 * psi) * sinh(2. * 2 * eta)) + (2. * 3 * beta_3 * sin(2. * 3 * psi) * sinh(2. * 3 * eta)))
chi = asin (sin(psi_prime)/cosh(eta_prime))
phi = chi + (delta_1 * sin(2. * 1 * chi)) + (delta_2 * sin(2. * 2 * chi)) + (delta_3 * sin(2. * 3 * chi))
lambda_0 = 0
lambdu = 0
k = 0
gamma = 0
return None
开发者ID:obsc,项目名称:flight-planner,代码行数:35,代码来源:greatcircle.py
示例16: sinh
def sinh(x):
_sinh_special = [
[inf+nanj, None, complex(-float("inf"), -0.0), -inf, None, inf+nanj, inf+nanj],
[nan+nanj, None, None, None, None, nan+nanj, nan+nanj],
[nanj, None, complex(-0.0, -0.0), complex(-0.0, 0.0), None, nanj, nanj],
[nanj, None, complex(0.0, -0.0), complex(0.0, 0.0), None, nanj, nanj],
[nan+nanj, None, None, None, None, nan+nanj, nan+nanj],
[inf+nanj, None, complex(float("inf"), -0.0), inf, None, inf+nanj, inf+nanj],
[nan+nanj, nan+nanj, complex(float("nan"), -0.0), nan, nan+nanj, nan+nanj, nan+nanj]
]
z = _make_complex(x)
if not isfinite(z):
if math.isinf(z.imag) and not math.isnan(z.real):
raise ValueError
if math.isinf(z.real) and math.isfinite(z.imag) and z.imag != 0:
if z.real > 0:
return complex(math.copysign(inf, math.cos(z.imag)),
math.copysign(inf, math.sin(z.imag)))
return complex(-math.copysign(inf, math.cos(z.imag)),
math.copysign(inf, math.sin(z.imag)))
return _sinh_special[_special_type(z.real)][_special_type(z.imag)]
if abs(z.real) > _LOG_LARGE_DOUBLE:
x_minus_one = z.real - math.copysign(1, z.real)
return complex(math.cos(z.imag) * math.sinh(x_minus_one) * e,
math.sin(z.imag) * math.cosh(x_minus_one) * e)
return complex(math.cos(z.imag) * math.sinh(z.real),
math.sin(z.imag) * math.cosh(z.real))
开发者ID:pombredanne,项目名称:ouroboros,代码行数:31,代码来源:cmath.py
示例17: cosh
def cosh(x):
_cosh_special = [
[inf+nanj, None, inf, complex(float("inf"), -0.0), None, inf+nanj, inf+nanj],
[nan+nanj, None, None, None, None, nan+nanj, nan+nanj],
[nan, None, 1, complex(1, -0.0), None, nan, nan],
[nan, None, complex(1, -0.0), 1, None, nan, nan],
[nan+nanj, None, None, None, None, nan+nanj, nan+nanj],
[inf+nanj, None, complex(float("inf"), -0.0), inf, None, inf+nanj, inf+nanj],
[nan+nanj, nan+nanj, nan, nan, nan+nanj, nan+nanj, nan+nanj]
]
z = _make_complex(x)
if not isfinite(z):
if math.isinf(z.imag) and not math.isnan(z.real):
raise ValueError
if math.isinf(z.real) and math.isfinite(z.imag) and z.imag != 0:
if z.real > 0:
return complex(math.copysign(inf, math.cos(z.imag)),
math.copysign(inf, math.sin(z.imag)))
return complex(math.copysign(inf, math.cos(z.imag)),
-math.copysign(inf, math.sin(z.imag)))
return _cosh_special[_special_type(z.real)][_special_type(z.imag)]
if abs(z.real) > _LOG_LARGE_DOUBLE:
x_minus_one = z.real - math.copysign(1, z.real)
ret = complex(e * math.cos(z.imag) * math.cosh(x_minus_one),
e * math.sin(z.imag) * math.sinh(x_minus_one))
else:
ret = complex(math.cos(z.imag) * math.cosh(z.real),
math.sin(z.imag) * math.sinh(z.real))
if math.isinf(ret.real) or math.isinf(ret.imag):
raise OverflowError
return ret
开发者ID:pombredanne,项目名称:ouroboros,代码行数:35,代码来源:cmath.py
示例18: fromwgs84
def fromwgs84(lat, lng, pkm=False):
"""
Convert coordintes from WGS84 to TWD97
pkm true for Penghu, Kinmen and Matsu area
The latitude and longitude can be in the following formats:
[+/-]DDD°MMM'SSS.SSSS" (unicode)
[+/-]DDD°MMM.MMMM' (unicode)
[+/-]DDD.DDDDD (string, unicode or float)
The returned coordinates are in meters
"""
_lng0 = lng0pkm if pkm else lng0
lat = radians(todegdec(lat))
lng = radians(todegdec(lng))
t = sinh((atanh(sin(lat)) - 2*pow(n,0.5)/(1+n)*atanh(2*pow(n,0.5)/(1+n)*sin(lat))))
epsilonp = atan(t/cos(lng-_lng0))
etap = atan(sin(lng-_lng0) / pow(1+t*t, 0.5))
E = E0 + k0*A*(etap + alpha1*cos(2*1*epsilonp)*sinh(2*1*etap) +
alpha2*cos(2*2*epsilonp)*sinh(2*2*etap) +
alpha3*cos(2*3*epsilonp)*sinh(2*3*etap))
N = N0 + k0*A*(epsilonp + alpha1*sin(2*1*epsilonp)*cosh(2*1*etap) +
alpha2*sin(2*2*epsilonp)*cosh(2*2*etap) +
alpha3*sin(2*3*epsilonp)*cosh(2*3*etap))
return E*1000, N*1000
开发者ID:shupingT,项目名称:twd97,代码行数:29,代码来源:converter.py
示例19: 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
示例20: from_utm
def from_utm(easting: float, northing: float,
zone: int, hemisphere: int =1) -> (float, float):
"""
Convert UTM coordinates to decimal latitude and longitude coordinates.
Keyword Arguments:
easting: The easting in m.
northing: The northing in m.
zone: The zone, an integer between 1 and 60, inclusive.
hemisphere: A signed number, where a negative number indicates the
coordinates are located in the southern hemisphere.
Returns:
latitude: The latitude in decimal degrees.
longitude: The longitude in deciaml degrees.
Raises:
OverflowError: The coordinate does not exist.
"""
easting, northing = easting/1000, northing/1000
northing_ = 10000 if hemisphere < 0 else 0
xi_ = xi = (northing - northing_)/(k0*A)
eta_ = eta = (easting - easting_)/(k0*A)
for j in range(1, 4):
p, q = 2*j*xi, 2*j*eta
xi_ -= beta[j - 1]*sin(p)*cosh(q)
eta_ -= beta[j - 1]*cos(p)*sinh(q)
chi = asin(sin(xi_)/cosh(eta_))
latitude = chi + sum(delta[j - 1]*sin(2*j*chi) for j in range(1, 4))
longitude_ = radians(6*zone - 183)
longitude = longitude_ + atan2(sinh(eta_), cos(xi_))
return degrees(latitude), degrees(longitude)
开发者ID:jonathanlee1,项目名称:SARBayes,代码行数:34,代码来源:coordinates.py
注:本文中的math.sinh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论