-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcoefficients_test.go
44 lines (34 loc) · 1.05 KB
/
coefficients_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2017 Andreas Pannewitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ps_test
import (
"github.com/GoLangsam/powser"
)
// ===========================================================================
// special rational coefficients
// aC is just a shorthand useful in math with Coefficients.
func aC() ps.Coefficient {
return ps.NewCoefficient(0, 1)
}
// aZero returns a zero.
func aZero() ps.Coefficient {
return ps.NewCoefficient(0, 1)
}
// aOne returns a one.
func aOne() ps.Coefficient {
return ps.NewCoefficient(1, 1)
}
// aMinusOne returns a minus one `-1`.
func aMinusOne() ps.Coefficient {
return ps.NewCoefficient(-1, 1)
}
// ratIby1 creates a new Rat `i/1` from int `i`.
func ratIby1(i int) ps.Coefficient {
return ps.NewCoefficient(int64(i), 1)
}
// rat1byI creates a new Rat `1/i` from int `i`.
func rat1byI(i int) ps.Coefficient {
return ps.NewCoefficient(1, int64(i))
}
// ===========================================================================