polynomial

package
v0.0.2-0...-db6250e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2020 License: CC0-1.0, CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignVariableNames

func AssignVariableNames(R Interface, names []string) error

AssignVariableNames assigns names to the variables of the polynomial ring R to be used in printing. The variables are indexed from 0 up to rank - 1 (inclusive).

func Coefficients

func Coefficients(R Interface, f object.Element) ([]object.Element, error)

Coefficients returns the slice of coefficients of the polynomial f in the polynomial ring R. Only the non-zero coefficients will be returned, hence the zero polynomial returns an empty slices. The returned coefficients are elements of the coefficient ring of R. If R satisfies the interface:

type Coefficientser interface {
	Coefficients(f object.Element) ([]object.Element, error)
		// Coefficients returns the slice of coefficients of the
		   polynomial f. Only the non-zero coefficients will be
		   returned, hence the zero polynomial returns an empty slices.
		   The returned coefficients are elements of the coefficient
		   ring.
}

then R's Coefficients method will be called.

func CoefficientsAndExponents

func CoefficientsAndExponents(R Interface, f object.Element) (cs []object.Element, es []object.Element, err error)

CoefficientsAndExponents returns two parallel slices of coefficients cs and exponents es of the polynomial f in the polynomial ring R. Only the non-zero coefficients will be returned, hence the zero polynomial returns two empty slices. The returned coefficients are elements of the coefficient ring of R, and the returned exponents are elements of the monoid of exponents of R. The exponents are sorted in increasing order. If R satisfies the interface:

type CoefficientsAndExponentser interface {
	CoefficientsAndExponents(f object.Element) (cs []object.Element,
		es []object.Element, err error) // CoefficientsAndExponents
		   returns two parallel slices of coefficients cs and exponents
		   es of the polynomial f. Only the non-zero coefficients will
		   be returned, hence the zero polynomial returns two empty
		   slices. The returned coefficients are elements of the
		   coefficient ring, and the returned exponents are elements of
	  	   the monoid of exponents. The exponents are sorted in
		   increasing order.
}

then R's CoefficientsAndExponents method will be called.

func ConstantCoefficient

func ConstantCoefficient(R Interface, f object.Element) (object.Element, error)

ConstantCoefficient returns the constant coefficient of the polynomial f in the polynomial ring R. The returned coefficient is an element of the coefficient ring of R. If R satisfies the interface:

type ConstantCoefficienter interface {
	ConstantCoefficient(f object.Element) (object.Element, error)
		// ConstantCoefficient returns the constant coefficient of the
		   polynomial f. The returned coefficient is an element of the
		   coefficient ring.
}

then R's ConstantCoefficient method will be called.

func IsConstant

func IsConstant(R Interface, f object.Element) (bool, object.Element, error)

IsConstant returns true iff f is a constant polynomial in the polynomial ring R. If true, also returns the constant. The returned constant is an element of the coefficient ring of R. If R satisfies the interface:

type IsConstanter interface {
	IsConstant(f object.Element) (bool, object.Element, error)
		// IsConstant returns true iff f is a constant polynomial. If
		   true, also returns the constant.
}

then R's IsConstant method will be called.

func IsMonic

func IsMonic(R Interface, f object.Element) (bool, error)

IsMonic returns true iff f is a monic polynomial (that is, if the leading coefficient of f is 1) in the polynomial ring R. If R satisfies the interface:

type IsMonicer interface {
	IsMonic(f object.Element) (bool, error) // IsMonic returns true iff
	   f is a monic polynomial (that is, if the leading coefficient of
	   f is 1).
}

then R's IsMonic method will be called.

func IsMonomial

func IsMonomial(R Interface, f object.Element) (bool, error)

IsMonomial returns true iff the polynomial f is a monomial (that is, if f is of the form x^m for exponent m) in the polynomial ring R. If R satisfies the interface:

type IsMonomialer interface {
	IsMonomial(f object.Element) (bool, error) // IsMonomial returns
	   true iff the polynomial f is a monomial (that is, if f is of the
	   form x^m, for some element m in the monoid of exponents).
}

then R's IsMonomial method will be called.

func IsTerm

func IsTerm(R Interface, f object.Element) (bool, error)

IsTerm returns true iff f is a term (that is, if f is of the form c * x^m for some coefficient c and exponent m) in the polynomial ring R. If R satisfies the interface:

type IsTermer interface {
	IsTerm(f object.Element) (bool, error) // IsTerm returns true iff f
	   is a term (that is, if f is of the form c * x^m for some element
	   c in the coefficient ring, and some element m in the monoid of
	   exponents.).
}

then R's IsTerm method will be called.

func LeadingCoefficient

func LeadingCoefficient(R Interface, f object.Element) (object.Element, error)

LeadingCoefficient returns the leading coefficient of the polynomial f in the polynomial ring R. The returned coefficient is an element of the coefficient ring of R. If R satisfies the interface:

type LeadingCoefficienter interface {
	LeadingCoefficient(f object.Element) (object.Element, error)
		// LeadingCoefficient returns the leading coefficient of the
		   polynomial f. The returned coefficient is an element of the
		   coefficient ring.
}

then R's LeadingCoefficient method will be called.

func LeadingMonomial

func LeadingMonomial(R Interface, f object.Element) (object.Element, error)

LeadingMonomial returns the leading monomial of the non-zero polynomial f in the polynomial ring R. If R satisfies the interface:

type LeadingMonomialer interface {
	LeadingMonomial(f object.Element) (object.Element, error)
		// LeadingMonomial returns the leading monomial of the non-zero
		   polynomial f.
}

then R's LeadingMonomial method will be called.

func LeadingTerm

func LeadingTerm(R Interface, f object.Element) (object.Element, error)

LeadingTerm returns the leading term of the polynomial f in the polynomial ring R. If R satisfies the interface:

type LeadingTermer interface {
	LeadingTerm(f object.Element) (object.Element, error)
		// LeadingTerm returns the leading term of the polynomial f.
}

then R's LeadingTerm method will be called.

func MonomialOrder

func MonomialOrder(R Interface) monomialorder.Type

MonomialOrder returns the monomial order on the exponent monoid of the polynomial ring R.

func Rank

func Rank(R Interface) int

Rank returns the rank of the polynomial ring R (that is, the rank of the exponent monoid, or equivalently the number of variables of R).

func Terms

func Terms(R Interface, f object.Element) ([]object.Element, error)

Terms returns the non-zero terms of the polynomial f in the polynomial ring R, sorted in increasing exponent order. The returned terms are elements of R. If R satisfies the interface:

type Termser interface {
	Terms(f object.Element) ([]object.Element, error) // Terms returns
	   the non-zero terms of the polynomial f, sorted in increasing
	   exponent order.
}

then R's Terms method will be called.

func Variable

func Variable(R Interface, i int) (object.Element, error)

Variable returns the i-th variable x_i of the polynomial ring R, if supported. Variables are indexed from 0 up to rank - 1 (inclusive). This is supported if and only if R satisfies the interface:

type Variabler interface {
	Variable(i int) (object.Element, error) // Variable returns the
	   i-th variable x_i of the polynomial ring. The variables are
	   indexed from 0 up to rank - 1 (inclusive).
}

func VariableNames

func VariableNames(R Interface) ([]string, error)

VariableNames returns the names to be used in printing of the variables of the polynomial ring R.

func Variables

func Variables(R Interface) ([]object.Element, error)

Variables returns the variables of the polynomial ring R, if supported. This is supported if and only if R satisfies the Variabler interface as described in the Variable function.

Types

type ExponentMonoid

ExponentMonoid defines the interface satisfied by the abelian monoid containing the exponents.

type Interface

type Interface interface {
	ring.Interface
	CoefficientRing() ring.Interface                                                        // CoefficientRing returns the ring containing the coefficients.
	ExponentMonoid() ExponentMonoid                                                         // ExponentMonoid returns the abelian monoid containing the exponents.
	CmpLeadingMonomial(f object.Element, g object.Element) (int, error)                     // CmpLeadingMonomial returns -1 if LM(f) < LM(g), 0 if LM(f) = LM(g), and +1 if LM(f) > LM(g), were LM denotes the leading monomial, and f and g are non-zero polynomials.
	ScalarMultiplyByCoefficient(c object.Element, f object.Element) (object.Element, error) // ScalarMultiplyByCoefficient returns the product c * f of the polynomial f with the element c in the coefficient ring.
	Degree(f object.Element) (object.Element, error)                                        // Degree returns the degree of the non-zero polynomial f. The returned exponent is an element in the exponent monoid.
	Valuation(f object.Element) (object.Element, error)                                     // Valuation returns the exponent of the smallest non-zero term of the non-zero polynomial f. The returned exponent is an element in the exponent monoid.
	Exponents(f object.Element) ([]object.Element, error)                                   // Exponents returns a slice of exponents of the polynomial f. Only the exponents corresponding to terms with non-zero coefficient will be returned, hence the zero polynomial returns an empty slice. The returned exponents will live in the exponent monoid. The exponents are sorted in increasing order.
	Coefficient(f object.Element, n object.Element) (object.Element, error)                 // Coefficient returns the coefficient of the multi-degree n term of the polynomial f.
	ToMonomial(m object.Element) (object.Element, error)                                    // ToMonomial returns the monomial x^m, where m is an element in the monoid of exponents.
	ToTerm(c object.Element, m object.Element) (object.Element, error)                      // ToTerm returns the term c * x^m, where c is an element in the coefficient ring, and m is an element in the monoid of exponents.
	AssignName(name string)                                                                 // AssignName assigns a name the ring to be used in printing.
	AssignVariableName(name string, i int) error                                            // AssignVariableName assigns a name to the i-th variable of the ring to be used in printing. The variables are indexed from 0 up to rank - 1 (inclusive).
	VariableName(i int) (string, error)                                                     // VariableName returns the name to be used in printing of the i-th variable of the ring. The variables are indexed from 0 up to rank - 1 (inclusive).
}

Interface defines the interface that all polynomial rings must satisfy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL