1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 07:42:27 +08:00

feat: add Variance for math package

This commit is contained in:
dudaodong
2024-11-18 16:25:32 +08:00
parent ec161f335d
commit 6b2c91b0f6
5 changed files with 130 additions and 0 deletions

View File

@@ -478,3 +478,15 @@ func ExampleDiv() {
// 0.5
// 0
}
func ExampleVariance() {
result1 := Variance([]int{1, 2, 3, 4, 5})
result2 := Variance([]float64{1.1, 2.2, 3.3, 4.4, 5.5})
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 2
// 2.42
}