Go (golang) library implementing rational complex numbers.
BigCは実部、虚部が共に有理数であるような複素数を扱うためのパッケージです。
type BigC struct {
}
A BigC object represents a rational complex number.
BigCは複素数を表します。
func NewBigC(r *big.Rat, i *big.Rat) *BigC
NewBigC creates a new BigC with real-part r and imaginary-part i.
func ParseString(expr string) (*BigC, error)
ParseString returns a new BigC instance of the result of the expression expr. Arithmetic operations and parentheses are supported.
func (x *BigC) AbsSq() *big.Rat
Abs sets z to square of |x| (the absolute value of x) and returns z.
func (z *BigC) Add(x *BigC, y *BigC) *BigC
Add sets z to the sum x+y and returns z.
func (z *BigC) Conj(x *BigC) *BigC
Conj sets z to the conjugate complex number of x and returns z.
func (z *BigC) Equal(x *BigC) bool
Equal reports whether x equals z.
func (x *BigC) FloatString(prec int) string
FloatString returns a string representation of x in decimal form with prec digits of precision after the radix point. The last digit is rounded to nearest, with halves rounded away from zero.
func (x *BigC) Imag() *big.Rat
Imag returns the imaginary-part of x. The result is a reference to x's imaginary-part; it may change if a new value is assigned to x, and vice versa.
func (z *BigC) Inv(x *BigC) *BigC
Inv sets z to 1/x and returns z. If x == 0, Inv panics.
func (x *BigC) IsPureImag() bool
IsPureImag reports whether x is a pure imaginary number.
func (x *BigC) IsReal() bool
IsReal reports whether x is a real number.
func (z *BigC) Mul(x *BigC, y *BigC) *BigC
Mul sets z to the product x*y and returns z.
func (z *BigC) Neg(x *BigC) *BigC
Neg sets z to -x and returns z.
func (z *BigC) Quo(x *BigC, y *BigC) *BigC
Quo sets z to the quotient x/y and returns z. If y == 0, Quo panics.
func (x *BigC) Real() *big.Rat
Real returns the real-part of x. The result is a reference to x's real-part; it may change if a new value is assigned to x, and vice versa.
func (z *BigC) Set(x *BigC) *BigC
Set sets z to x (by making a copy of x) and returns z.
func (x *BigC) String() string
String returns a string exact representation of x.
func (z *BigC) Sub(x *BigC, y *BigC) *BigC
Sub sets z to the difference x-y and returns z.