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


Golang math.Sinh函数代码示例

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


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

示例1: GridToGeodetic

//GridToGeodetic converts RT90 coordinates to WGS84
func GridToGeodetic(x, y float64) (float64, float64) {

	if CentralMeridian == 31337.0 {
		return 0.0, 0.0
	}

	e2 := Flattening * (2.0 - Flattening)
	n := Flattening / (2.0 - Flattening)
	a_roof := Axis / (1.0 + n) * (1.0 + n*n/4.0 + n*n*n*n/64.0)
	delta1 := n/2.0 - 2.0*n*n/3.0 + 37.0*n*n*n/96.0 - n*n*n*n/360.0
	delta2 := n*n/48.0 + n*n*n/15.0 - 437.0*n*n*n*n/1440.0
	delta3 := 17.0*n*n*n/480.0 - 37*n*n*n*n/840.0
	delta4 := 4397.0 * n * n * n * n / 161280.0

	Astar := e2 + e2*e2 + e2*e2*e2 + e2*e2*e2*e2
	Bstar := -(7.0*e2*e2 + 17.0*e2*e2*e2 + 30.0*e2*e2*e2*e2) / 6.0
	Cstar := (224.0*e2*e2*e2 + 889.0*e2*e2*e2*e2) / 120.0
	Dstar := -(4279.0 * e2 * e2 * e2 * e2) / 1260.0

	DegToRad := math.Pi / 180
	LambdaZero := CentralMeridian * DegToRad
	xi := (x - FalseNorthing) / (Scale * a_roof)
	eta := (y - FalseEasting) / (Scale * a_roof)
	xi_prim := xi - delta1*math.Sin(2.0*xi)*math.Cosh(2.0*eta) - delta2*math.Sin(4.0*xi)*math.Cosh(4.0*eta) - delta3*math.Sin(6.0*xi)*math.Cosh(6.0*eta) - delta4*math.Sin(8.0*xi)*math.Cosh(8.0*eta)
	eta_prim := eta - delta1*math.Cos(2.0*xi)*math.Sinh(2.0*eta) - delta2*math.Cos(4.0*xi)*math.Sinh(4.0*eta) - delta3*math.Cos(6.0*xi)*math.Sinh(6.0*eta) - 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 := LambdaZero + delta_lambda
	lat_radian := phi_star + math.Sin(phi_star)*math.Cos(phi_star)*(Astar+Bstar*math.Pow(math.Sin(phi_star), 2)+Cstar*math.Pow(math.Sin(phi_star), 4)+Dstar*math.Pow(math.Sin(phi_star), 6))

	return lat_radian * 180.0 / math.Pi, lon_radian * 180.0 / math.Pi
}
开发者ID:peterstark72,项目名称:golang-skanetrafiken,代码行数:33,代码来源:geo.go

示例2: Tanh

// Tanh 返回 x 的双曲正切。
func Tanh(x complex128) complex128 {
	d := math.Cosh(2*real(x)) + math.Cos(2*imag(x))
	if d == 0 {
		return Inf()
	}
	return complex(math.Sinh(2*real(x))/d, math.Sin(2*imag(x))/d)
}
开发者ID:gmwu,项目名称:go,代码行数:8,代码来源:tan.go

示例3: getLonLatFromTileName

// https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Tile_numbers_to_lon..2Flat.
func getLonLatFromTileName(x, y, zoom int64) Point {
	n := math.Pow(2, float64(zoom))
	lon := (float64(x) / n * 360) - 180
	latRad := math.Atan(math.Sinh(math.Pi * (1 - (2 * float64(y) / n))))
	lat := latRad * 180 / math.Pi

	return Point{lon, lat}
}
开发者ID:adentes-org,项目名称:KISSTile,代码行数:9,代码来源:mercator.go

示例4: xyz_lonlat

func xyz_lonlat(x, y, z int) (lon, lat float64) {
	n := 1 << uint(z)
	fact := tilesize * float64(n)
	lon = float64(x)*360/fact - 180
	prj := (1 - float64(y)*2/fact)*math.Pi
	lat = rad_deg(math.Atan(math.Sinh(prj)))
	return
}
开发者ID:tajtiattila,项目名称:go-mbtiles,代码行数:8,代码来源:util.go

示例5: sinhcosh

// 计算 sinh 和 cosh
func sinhcosh(x float64) (sh, ch float64) {
	if math.Abs(x) <= 0.5 {
		return math.Sinh(x), math.Cosh(x)
	}
	e := math.Exp(x)
	ei := 0.5 / e
	e *= 0.5
	return e - ei, e + ei
}
开发者ID:gmwu,项目名称:go,代码行数:10,代码来源:sin.go

示例6: SinH

// SinH returns the Cosine of a given angle
func SinH(number float64) (float64, error) {

	if math.IsNaN(number) {
		return 0.0, errors.New("#VALUE!	-	Occurred because the supplied number argument is non-numeric")
	}

	// Sinh returns the hyperbolic sine of x.
	return math.Sinh(number), nil
}
开发者ID:muyiwaolurin,项目名称:spreadsheet-functions,代码行数:10,代码来源:trigonometry.go

示例7: Cot

// Cot returns the cotangent of x.
func Cot(x complex128) complex128 {
	d := math.Cosh(2*imag(x)) - math.Cos(2*real(x))
	if math.Fabs(d) < 0.25 {
		d = tanSeries(x)
	}
	if d == 0 {
		return Inf()
	}
	return cmplx(math.Sin(2*real(x))/d, -math.Sinh(2*imag(x))/d)
}
开发者ID:rapgamer,项目名称:golang-china,代码行数:11,代码来源:tan.go

示例8: Tan

// Tan 返回 x 的正切值。
func Tan(x complex128) complex128 {
	d := math.Cos(2*real(x)) + math.Cosh(2*imag(x))
	if math.Abs(d) < 0.25 {
		d = tanSeries(x)
	}
	if d == 0 {
		return Inf()
	}
	return complex(math.Sin(2*real(x))/d, math.Sinh(2*imag(x))/d)
}
开发者ID:gmwu,项目名称:go,代码行数:11,代码来源:tan.go

示例9: GeodeticToGrid

//GeodeticToGrid converts WGS84 coordinates to RT90
func GeodeticToGrid(lat, lon float64) (x, y float64) {

	// Prepare ellipsoid-based stuff.
	e2 := Flattening * (2.0 - Flattening)
	n := Flattening / (2.0 - Flattening)
	a_roof := Axis / (1.0 + n) * (1.0 + n*n/4.0 + n*n*n*n/64.0)
	A := e2
	B := (5.0*e2*e2 - e2*e2*e2) / 6.0
	C := (104.0*e2*e2*e2 - 45.0*e2*e2*e2*e2) / 120.0
	D := (1237.0 * e2 * e2 * e2 * e2) / 1260.0
	beta1 := n/2.0 - 2.0*n*n/3.0 + 5.0*n*n*n/16.0 + 41.0*n*n*n*n/180.0
	beta2 := 13.0*n*n/48.0 - 3.0*n*n*n/5.0 + 557.0*n*n*n*n/1440.0
	beta3 := 61.0*n*n*n/240.0 - 103.0*n*n*n*n/140.0
	beta4 := 49561.0 * n * n * n * n / 161280.0

	// Convert.
	DegToRad := math.Pi / 180.0
	phi := lat * DegToRad
	lambd := lon * DegToRad
	lambda_zero := CentralMeridian * DegToRad

	phi_star := phi - math.Sin(phi)*math.Cos(phi)*(A+
		B*math.Pow(math.Sin(phi), 2)+
		C*math.Pow(math.Sin(phi), 4)+
		D*math.Pow(math.Sin(phi), 6))
	delta_lambda := lambd - lambda_zero
	xi_prim := math.Atan(math.Tan(phi_star) / math.Cos(delta_lambda))
	eta_prim := math.Atanh(math.Cos(phi_star) * math.Sin(delta_lambda))
	x = Scale*a_roof*(xi_prim+
		beta1*math.Sin(2.0*xi_prim)*math.Cosh(2.0*eta_prim)+
		beta2*math.Sin(4.0*xi_prim)*math.Cosh(4.0*eta_prim)+
		beta3*math.Sin(6.0*xi_prim)*math.Cosh(6.0*eta_prim)+
		beta4*math.Sin(8.0*xi_prim)*math.Cosh(8.0*eta_prim)) +
		FalseNorthing
	y = Scale*a_roof*(eta_prim+
		beta1*math.Cos(2.0*xi_prim)*math.Sinh(2.0*eta_prim)+
		beta2*math.Cos(4.0*xi_prim)*math.Sinh(4.0*eta_prim)+
		beta3*math.Cos(6.0*xi_prim)*math.Sinh(6.0*eta_prim)+
		beta4*math.Cos(8.0*xi_prim)*math.Sinh(8.0*eta_prim)) +
		FalseEasting
	return x, y
}
开发者ID:peterstark72,项目名称:golang-skanetrafiken,代码行数:43,代码来源:geo.go

示例10: XYToLonLat

func XYToLonLat(xtile, ytile int, zoom uint) Point {
	var lon_deg, lat_deg float64
	var rt Point
	b := (1 << zoom)
	n := float64(b)
	lon_deg = (float64)(xtile*360)/n - 180
	lat_deg = math.Atan(math.Sinh(math.Pi*(1-2*(float64)(ytile)/n))) * 180 / math.Pi
	rt.lon = lon_deg
	rt.lat = lat_deg
	return rt
}
开发者ID:xuhao1,项目名称:GDEM-server,代码行数:11,代码来源:main.go

示例11: CentralPoint

// returns coordinates of central point of tile by tile-hash
func CentralPoint(hash int64) [2]float32 {
	z, x, y := HashtoZXY(hash)

	n := math.Pow(2, float64(z))

	lon_deg := ((float64(x)+0.5)/n)*360.0 - 180.0
	lat_rad := math.Atan(math.Sinh(math.Pi * (1 - (2*(float64(y)+0.5))/n)))
	lat_deg := lat_rad * (180.0 / math.Pi)

	return [2]float32{float32(lat_deg), float32(lon_deg)}
}
开发者ID:owm-inc,项目名称:thash,代码行数:12,代码来源:thash.go

示例12: TestMathSinh

func TestMathSinh(t *testing.T) {
	// This is just an interface to Go's function, so just a quick simple test
	ctx := runtime.NewCtx(nil, nil)
	mm := new(MathMod)
	mm.SetCtx(ctx)
	val := 1.12
	ret := mm.math_Sinh(runtime.Number(val))
	exp := math.Sinh(val)
	if ret.Float() != exp {
		t.Errorf("expected %f, got %f", exp, ret.Float())
	}
}
开发者ID:jmptrader,项目名称:agora,代码行数:12,代码来源:math_test.go

示例13: CscH

//CscH Returns the hyperbolic cosecant of an angle
func CscH(number float64) (float64, error) {

	if number == 0 {
		return 0.0, errors.New("#DIV/0!	-	Occurred because the supplied number argument is equal to zero")
	}

	if number < -134217728 || number > 134217728 {
		return 0.0, errors.New("#NUM! -  Occurred because the supplied number argument is less than -2^27 or is greater than 2^27")
	}

	if math.IsNaN(number) {
		return 0.0, errors.New("#VALUE!	-	Occurred because the supplied number argument is non-numeric")
	}

	return 1 / math.Sinh(number), nil
}
开发者ID:muyiwaolurin,项目名称:spreadsheet-functions,代码行数:17,代码来源:trigonometry.go

示例14: SinK

// Func SinK computes the curvature dependent distance
func SinK(omkh2, d float64) float64 {
	k := math.Sqrt(math.Abs(omkh2))
	kd := k * d
	var ret float64
	switch {
	case (omkh2 > 0) && (kd > 1.e-2):
		ret = math.Sinh(kd) / k
	case (omkh2 < 0) && (kd > 1.e-2):
		ret = math.Sin(kd) / k
	case (omkh2 >= 0) && (kd < 1.e-2):
		ret = d + kd*kd*d/6
	case (omkh2 < 0) && (kd < 1.e-2):
		ret = d - kd*kd*d/6
	}
	return ret
}
开发者ID:npadmana,项目名称:npgo,代码行数:17,代码来源:cosmo.go

示例15:

// that will only work well +-10 degrees around longitude 0.
var TransverseMercator = Projection{
	Project: func(p *Point) {
		radLat := deg2rad(p.Lat())
		radLng := deg2rad(p.Lng())

		sincos := math.Sin(radLng) * math.Cos(radLat)
		p.SetX(0.5 * math.Log((1+sincos)/(1-sincos)) * EarthRadius)

		p.SetY(math.Atan(math.Tan(radLat)/math.Cos(radLng)) * EarthRadius)
	},
	Inverse: func(p *Point) {
		x := p.X() / EarthRadius
		y := p.Y() / EarthRadius

		lng := math.Atan(math.Sinh(x) / math.Cos(y))
		lat := math.Asin(math.Sin(y) / math.Cosh(x))

		p.SetLng(rad2deg(lng))
		p.SetLat(rad2deg(lat))
	},
}

// ScalarMercator converts from lng/lat float64 to x,y uint64.
// This is the same as Google's world coordinates.
var ScalarMercator struct {
	Level   uint64
	Project func(lng, lat float64, level ...uint64) (x, y uint64)
	Inverse func(x, y uint64, level ...uint64) (lng, lat float64)
}
开发者ID:thomaspeugeot,项目名称:go.geo,代码行数:30,代码来源:projections.go


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