Golang 基本三角反正切计算
Golang basic trigonometry arctan computation
这是一道 Trig 101 题。不幸的是,我不太记得我的基本触发(太旧了:)。我需要在 Golang 中找到一个公式来计算给定系数的角度(以度为单位)。例如:
Tan(角度) = 系数
角度=arctan(系数)
例子:
角度 = arctan(0.2) = 11.31 度(其中系数 = 0.2)
角度 = arctan(0.3) = 16.699 度(其中系数 = 0.3)
角度 = arctan(0.5) = 26.565 度(其中系数 = 0.5)
下面的 URL 给出了显示正确值的计算器:
http://www.rapidtables.com/calc/math/Tan_Calculator.htm
根据这些示例,我如何导出用 Golang 编写的公式来计算给定系数的角度(以度为单位)?
提前感谢您的宝贵时间。
巴拉特
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))
}
这是一道 Trig 101 题。不幸的是,我不太记得我的基本触发(太旧了:)。我需要在 Golang 中找到一个公式来计算给定系数的角度(以度为单位)。例如:
Tan(角度) = 系数 角度=arctan(系数)
例子: 角度 = arctan(0.2) = 11.31 度(其中系数 = 0.2)
角度 = arctan(0.3) = 16.699 度(其中系数 = 0.3)
角度 = arctan(0.5) = 26.565 度(其中系数 = 0.5)
下面的 URL 给出了显示正确值的计算器:
http://www.rapidtables.com/calc/math/Tan_Calculator.htm
根据这些示例,我如何导出用 Golang 编写的公式来计算给定系数的角度(以度为单位)?
提前感谢您的宝贵时间。
巴拉特
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))
}