commit deletes
This commit is contained in:
parent
776bba907c
commit
372c577f83
233 changed files with 0 additions and 6724 deletions
|
|
@ -1,22 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/cmplx"
|
||||
)
|
||||
|
||||
func deg2rad(d float64) float64 { return d * math.Pi / 180 }
|
||||
func rad2deg(r float64) float64 { return r * 180 / math.Pi }
|
||||
|
||||
func mean_angle(deg []float64) float64 {
|
||||
sum := 0i
|
||||
for _, x := range deg { sum += cmplx.Rect(1, deg2rad(x)) }
|
||||
return rad2deg(cmplx.Phase(sum))
|
||||
}
|
||||
|
||||
func main() {
|
||||
for _, angles := range [][]float64 {{350, 10}, {90, 180, 270, 360}, {10, 20, 30}} {
|
||||
fmt.Printf("The mean angle of %v is: %f degrees\n", angles, mean_angle(angles))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue