route/vendor/github.com/aclements/go-moremath/mathx/beta_test.go

30 lines
729 B
Go
Raw Normal View History

2017-10-06 15:29:20 +00:00
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mathx
import (
"testing"
. "github.com/aclements/go-moremath/internal/mathtest"
)
func TestBetaInc(t *testing.T) {
// Example values from MATLAB betainc documentation.
WantFunc(t, "I_0.5(%v, 3)",
func(a float64) float64 { return BetaInc(0.5, a, 3) },
map[float64]float64{
0: 1.00000000000000,
1: 0.87500000000000,
2: 0.68750000000000,
3: 0.50000000000000,
4: 0.34375000000000,
5: 0.22656250000000,
6: 0.14453125000000,
7: 0.08984375000000,
8: 0.05468750000000,
9: 0.03271484375000,
10: 0.01928710937500})
}