2016-04-07 59 views
0

这是一个Trig 101问题。不幸的是,我不记得我的基本触发太好(太老:)。我需要在Golang中找到一个公式来计算给定系数的角度。作为一个例子:Golang基本三角arctan计算

谈(角度)=系数 角度=反正切(系数)

实例: 角度=反正切(0.2)= 11.31度(其中,系数= 0.2)

角度=反正切(0.3)= 16.699度(其中,系数= 0.3)

角度=反正切(0.5)= 26.565度(其中,系数= 0.5)

的URL下面给出其表示COR计算器RECT值:

http://www.rapidtables.com/calc/math/Tan_Calculator.htm

鉴于这些实施例中,我如何导出写入Golang计算中给出的系数度的角度的公式?

提前感谢您的时间。

巴拉特

+1

数学包有函数计算三角函数值:https://golang.org/pkg/math/#Atan –

回答

1

Go Playground

package main 

import (
    "fmt" 
    "math" 
) 

func main() { 
    fmt.Println("Tan: ", math.Tan(90)) 
    fmt.Println("Arctan: ", math.Atan(0.2)) 
    fmt.Println("Arctan: ", math.Atan(0.3)) 
    fmt.Println("Arctan: ", math.Atan(0.5)) 
} 

List of func in math package

+1

你要乘math.Atan(...)结果180/math.Pi将其转换为度。 – Bharat