// Yn returns the order-n Bessel function of the second kind.
//
// Special cases are:
//	Yn(n, +Inf) = 0
//	Yn(n > 0, 0) = -Inf
//	Yn(n < 0, 0) = +Inf if n is odd, -Inf if n is even
//	Y1(n, x < 0) = NaN
//	Y1(n, NaN) = NaN
553366
func Yn(n int, x float32) float32 {
	return engomath.Yn(n, x)
}
987792
func Hann(L int) []float64 {
	r := make([]float64, L)

	if L == 1 {
		r[0] = 1
	} else {
		N := L - 1
		coef := 2 * math.Pi / float64(N)
		for n := 0; n <= N; n++ {
			r[n] = 0.5 * (1 - math.Cos(coef*float64(n)))
		}
	}

	return r
}
596563
func (p Point) IsNaN() bool {
	return math.IsNaN(p.x) || math.IsNaN(p.y)
}
902886
func (u Vec) XY() (x, y float64) {
	return u.X, u.Y
}
1127816
func MinInt32N(v ...int32) int32 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinInt32(v[0], v[1])
	default:
		l := len(v) / 2
		return MinInt32N(MinInt32N(v[:l]...), MinInt32N(v[l:]...))
	}
}
848896
func F(n float64, v uint64) (f int64) {

	s := strconv.FormatFloat(n-float64(int64(n)), 'f', int(v), 64)

	// with either be '0' or '0.xxxx', so if 1 then f will be zero
	// otherwise need to parse
	if len(s) != 1 {

		// ignoring error, because it can't fail as we generated
		// the string internally from a real number
		f, _ = strconv.ParseInt(s[2:], 10, 64)
	}

	return
}
1254232
func SetN(n int) Option {
	return func(ngram *NGramIndex) error {
		if n < 2 || n > maxN {
			return errors.New("bad 'n' value for n-gram index")
		}
		ngram.n = n
		return nil
	}
}
707716
func Min(x, y float32) float32 {
	return float32(math.Min(float64(x), float64(y)))
}
968489
func (t *Translation) GetN(n int) string {
	// Look for Translation index
	if _, ok := t.Trs[n]; ok {
		if t.Trs[n] != "" {
			return t.Trs[n]
		}
	}

	// Return untranslated singular if corresponding
	if n == 0 {
		return t.ID
	}

	// Return untranslated plural by default
	return t.PluralID
}
743250
func isBetween(lowStr, highStr, xStr string) bool {
	low := bigIntFromStr(lowStr, 10)
	high := bigIntFromStr(highStr, 10)
	x := bigIntFromStr(xStr, 10)
	return x.Cmp(low) == 1 && x.Cmp(high) == -1
}
444678
func (m *MT19937) IntN(n int) int {
	// See if n is out of bounds
	if n <= 0 || n > 1<<31-1 {
		panic("invalid argument to IntN")
	}
	// Can shortcut Ns that are power of 2
	if n&(n-1) == 0 {
		return m.Int() & (n - 1)
	}
	max := int32((1 << 31) - 1 - (1<<31)%uint32(n)) // calculate the max; reject anything >
	r := m.Int()
	for int32(r) > max {
		r = m.Int()
	}
	return r % n
}
935106
func fibonacciNumber(n uint) uint {
	if 0 == n {
		return 0
	} else if 1 == n {
		return 1
	} else {
		return fibonacciNumber(n-1) + fibonacciNumber(n-2)
	}
}
1342561
func Jn(n int, x float32) float32 {
	return engomath.Jn(n, x)
}
1154950
func DigitsN(n int) string {
	digits := make([]rune, n)
	for i := 0; i < n; i++ {
		digits[i] = numeric[r.Intn(len(numeric))]
	}
	return string(digits)
}
788539
func (l *LeastSquares) J() (float64, error) {
	var sum float64

	for i := range l.trainingSet {
		prediction, err := l.Predict(l.trainingSet[i])
		if err != nil {
			return 0, err
		}

		sum += (l.expectedResults[i] - prediction[0]) * (l.expectedResults[i] - prediction[0])
	}

	// add regularization term!
	//
	// notice that the constant term doesn't matter
	for i := 1; i < len(l.Parameters); i++ {
		sum += l.regularization * l.Parameters[i] * l.Parameters[i]
	}

	return sum / float64(2*len(l.trainingSet)), nil
}
1080482
func Fn(name string, paramNames ...string) *Func {
	return &Func{
		Name:       name,
		ParamNames: paramNames,
	}
}
635984
func (s *Statistics) N() uint64 {
	s.RLock()
	defer s.RUnlock()
	return s.samples
}