英文:
Golang basic trigonometry arctan computation
问题
这是一个三角函数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)
下面的链接提供了一个计算器,显示了正确的值:
http://www.rapidtables.com/calc/math/Tan_Calculator.htm
根据这些例子,我该如何推导出一个用Golang编写的公式来计算给定系数的角度?
提前感谢你的时间。
Bharat
英文:
This is a Trig 101 question. Unfortunately, I don't remember my basic trig too well (too old :). I need to find a formula in Golang to compute the angle in degrees given the coefficient. As an example:
Tan(angle) = coefficient
Angle = arctan (coefficient)
Examples:
Angle = arctan(0.2) = 11.31 degrees (where coefficient = 0.2)
Angle = arctan(0.3) = 16.699 degrees (where coefficient = 0.3)
Angle = arctan(0.5) = 26.565 degrees (where coefficient = 0.5)
The URL below gives the calculator which is showing the correct values:
http://www.rapidtables.com/calc/math/Tan_Calculator.htm
Given these examples, how do I derive a formula written in Golang to compute the angle in degrees given the coefficient?
Thanks in advance for your time.
Bharat
答案1
得分: 2
这是你要翻译的内容:
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))
}
英文:
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))
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论