NZMATH
1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
![]() ![]() |
Public Member Functions | |
def | __init__ (self, coefficients, **kwds) |
def | __mul__ (self, other) |
def | __rmul__ (self, other) |
def | ring_mul (self, other) |
def | scalar_mul (self, scale) |
def | term_mul (self, term) |
def | __pow__ (self, index) |
def | square (self) |
def | __hash__ (self) |
def | __call__ (self, target, value) |
def | __len__ (self) |
def | __getitem__ (self, index) |
def | iterterms (self) |
def | itercoefficients (self) |
def | iterbases (self) |
def | partial_differentiate (self, target) |
def | erase_variable (self, target=0) |
def | combine_similar_terms (self, target) |
def | __repr__ (self) |
def | construct_with_default (self, maindata) |
![]() | |
def | total_degree (self) |
def | __neg__ (self) |
def | __pos__ (self) |
![]() | |
def | __iter__ (self) |
def | __contains__ (self, base) |
def | __eq__ (self, other) |
def | __ne__ (self, other) |
def | __nonzero__ (self) |
def | __add__ (self, other) |
def | __sub__ (self, other) |
def | terms (self) |
def | coefficients (self) |
def | bases (self) |
def | terms_map (self, func) |
def | coefficients_map (self, func) |
def | bases_map (self, func) |
Public Attributes | |
number_of_variables | |
Private Attributes | |
_coefficients | |
_init_kwds | |
The class for basic multivariate polynomials.
Definition at line 179 of file multivar.py.
def nzmath.poly.multivar.BasicPolynomial.__init__ | ( | self, | |
coefficients, | |||
** | kwds | ||
) |
BasicPolynomial(coefficients [, keyword_arguments...]) coefficients can be any dict initial values.
Reimplemented in nzmath.poly.multiutil.UniqueFactorizationDomainPolynomial, nzmath.poly.multiutil.DomainPolynomial, and nzmath.poly.multiutil.RingPolynomial.
Definition at line 184 of file multivar.py.
def nzmath.poly.multivar.BasicPolynomial.__call__ | ( | self, | |
target, | |||
value | |||
) |
Substitute 'value' to 'target' index variable. If 'target' is a tuple of indices, it has to be sorted and 'value' also has to be a tuple of the same length. Note that the result will not be a univar polynomial nor a scalar.
Definition at line 340 of file multivar.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, nzmath.matrix.Subspace.__class__, and nzmath.poly.multivar.BasicPolynomial._init_kwds.
def nzmath.poly.multivar.BasicPolynomial.__getitem__ | ( | self, | |
index | |||
) |
Return the coefficient of specified index (tuple of degrees). If there is no term of index, return 0.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 372 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
def nzmath.poly.multivar.BasicPolynomial.__hash__ | ( | self | ) |
hash(self) Return the hash satisfying hash(self) == hash(other) if self == other.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 328 of file multivar.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, and nzmath.matrix.Subspace.__class__.
def nzmath.poly.multivar.BasicPolynomial.__len__ | ( | self | ) |
Return the number of data entries.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 366 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
def nzmath.poly.multivar.BasicPolynomial.__mul__ | ( | self, | |
other | |||
) |
self * other If type of other is Polynomial, do multiplication in ring. Otherwise, do scalar multiplication.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 201 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial.ring_mul(), nzmath.poly.array.ArrayPoly.scalar_mul(), nzmath.poly.multivar.BasicPolynomial.scalar_mul(), nzmath.poly.array.ArrayPolyMod.scalar_mul(), nzmath.poly.formalsum.DictFormalSum.scalar_mul(), and nzmath.poly.formalsum.ListFormalSum.scalar_mul().
def nzmath.poly.multivar.BasicPolynomial.__pow__ | ( | self, | |
index | |||
) |
self ** index pow with three arguments is not supported by default.
Definition at line 259 of file multivar.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), and nzmath.poly.multivar.BasicPolynomial.square().
def nzmath.poly.multivar.BasicPolynomial.__repr__ | ( | self | ) |
Reimplemented in nzmath.poly.multiutil.RingPolynomial.
Definition at line 447 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
def nzmath.poly.multivar.BasicPolynomial.__rmul__ | ( | self, | |
other | |||
) |
other * self
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 213 of file multivar.py.
References nzmath.poly.array.ArrayPoly.scalar_mul(), nzmath.poly.multivar.BasicPolynomial.scalar_mul(), nzmath.poly.array.ArrayPolyMod.scalar_mul(), nzmath.poly.formalsum.DictFormalSum.scalar_mul(), and nzmath.poly.formalsum.ListFormalSum.scalar_mul().
def nzmath.poly.multivar.BasicPolynomial.combine_similar_terms | ( | self, | |
target | |||
) |
Combine similar terms and return the resulting univariate polynomial with polynomial coefficients in the form of list of (degree, coefficient) pairs. The target variable is specified by the position in indices.
Definition at line 432 of file multivar.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, nzmath.matrix.Subspace.__class__, nzmath.poly.multivar.BasicPolynomial._init_kwds, and nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default().
def nzmath.poly.multivar.BasicPolynomial.construct_with_default | ( | self, | |
maindata | |||
) |
Create a new multivar polynomial of the same class with self, with given only the maindata and use copy of self's data if necessary.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 450 of file multivar.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, nzmath.matrix.Subspace.__class__, and nzmath.poly.multivar.BasicPolynomial._init_kwds.
Referenced by nzmath.poly.uniutil.DivisionProvider.__divmod__(), nzmath.poly.uniutil.DivisionProvider.__floordiv__(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.__pow__(), nzmath.poly.uniutil.DivisionProvider._populate_reduced(), nzmath.poly.uniutil.DivisionProvider.mod(), nzmath.poly.uniutil.DivisionProvider.mod_pow(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_divmod(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_floordiv(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_mod(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_divmod(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_floordiv(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_mod(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.pthroot(), nzmath.poly.uniutil.KaratsubaProvider.ring_mul_karatsuba(), nzmath.poly.uniutil.OrderProvider.shift_degree_to(), nzmath.poly.uniutil.OrderProvider.split_at(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.split_same_degrees(), and nzmath.poly.uniutil.KaratsubaProvider.square_karatsuba().
def nzmath.poly.multivar.BasicPolynomial.erase_variable | ( | self, | |
target = 0 |
|||
) |
Erase a variable from the polynomial. The target variable is specified by the position in indices. The method takes no care about resulting polynomial type, i.e. the result remains as the same type even if their indices have length less than 2.
Definition at line 411 of file multivar.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, nzmath.matrix.Subspace.__class__, nzmath.poly.multivar.BasicPolynomial._init_kwds, nzmath.poly.multiutil.NestProvider.number_of_variables, nzmath.poly.multivar.BasicPolynomial.number_of_variables, and nzmath.poly.multiutil.PolynomialRingAnonymousVariables.number_of_variables.
def nzmath.poly.multivar.BasicPolynomial.iterbases | ( | self | ) |
iterator for degrees.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 391 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
def nzmath.poly.multivar.BasicPolynomial.itercoefficients | ( | self | ) |
iterator for coefficients.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 385 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
Referenced by nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.__pow__(), nzmath.poly.uniutil.DivisionProvider._populate_reduced(), nzmath.poly.uniutil.ContentProvider.content(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.distinct_degree_factorization(), nzmath.poly.multiutil.RingElementProvider.getRing(), nzmath.poly.uniutil.RingElementProvider.getRing(), and nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.split_same_degrees().
def nzmath.poly.multivar.BasicPolynomial.iterterms | ( | self | ) |
iterator for (degree, coefficient) pairs.
Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.
Definition at line 379 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._coefficients.
def nzmath.poly.multivar.BasicPolynomial.partial_differentiate | ( | self, | |
target | |||
) |
Return the polynomial obtained by partial differentiation with the 'target' index variable.
Definition at line 397 of file multivar.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default().
def nzmath.poly.multivar.BasicPolynomial.ring_mul | ( | self, | |
other | |||
) |
self * other Both self and other must have the same length tuples of indices for every term.
Definition at line 219 of file multivar.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default().
Referenced by nzmath.poly.univar.BasicPolynomial.__mul__(), nzmath.poly.multivar.BasicPolynomial.__mul__(), and nzmath.poly.univar.SortedPolynomial.__mul__().
def nzmath.poly.multivar.BasicPolynomial.scalar_mul | ( | self, | |
scale | |||
) |
Return the result of scalar multiplication.
Definition at line 241 of file multivar.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default().
Referenced by nzmath.poly.univar.BasicPolynomial.__mul__(), nzmath.poly.multivar.BasicPolynomial.__mul__(), nzmath.poly.univar.SortedPolynomial.__mul__(), nzmath.poly.univar.BasicPolynomial.__rmul__(), nzmath.poly.multivar.BasicPolynomial.__rmul__(), nzmath.poly.univar.SortedPolynomial.__rmul__(), and nzmath.poly.uniutil.DivisionProvider._populate_reduced().
def nzmath.poly.multivar.BasicPolynomial.square | ( | self | ) |
Return squared polynomial.
Definition at line 302 of file multivar.py.
References nzmath.poly.multivar.BasicPolynomial._init_kwds, nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), and nzmath.poly.multiutil.polynomial().
Referenced by nzmath.poly.univar.BasicPolynomial.__pow__(), nzmath.poly.multivar.BasicPolynomial.__pow__(), nzmath.poly.univar.SortedPolynomial.__pow__(), nzmath.poly.uniutil.FieldPolynomial.__pow__(), and nzmath.poly.uniutil.PseudoDivisionProvider.monic_pow().
def nzmath.poly.multivar.BasicPolynomial.term_mul | ( | self, | |
term | |||
) |
Return the result of multiplication with the given term. The term can be given as a tuple (degree indices, coeff) or as a Polynomial instance.
Definition at line 247 of file multivar.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default().
Referenced by nzmath.poly.univar.SortedPolynomial.ring_mul_karatsuba(), and nzmath.poly.uniutil.KaratsubaProvider.ring_mul_karatsuba().
|
private |
Definition at line 191 of file multivar.py.
Referenced by nzmath.poly.univar.BasicPolynomial.__call__(), nzmath.poly.univar.BasicPolynomial.__contains__(), nzmath.poly.univar.BasicPolynomial.__getitem__(), nzmath.poly.multivar.BasicPolynomial.__getitem__(), nzmath.poly.multiutil.RingPolynomial.__init__(), nzmath.poly.univar.BasicPolynomial.__len__(), nzmath.poly.multivar.BasicPolynomial.__len__(), nzmath.poly.multivar.PolynomialInterface.__pos__(), nzmath.poly.univar.BasicPolynomial.__pos__(), nzmath.poly.univar.BasicPolynomial.__pow__(), nzmath.poly.multiutil.RingPolynomial.__repr__(), nzmath.poly.univar.BasicPolynomial.__repr__(), nzmath.poly.multivar.BasicPolynomial.__repr__(), nzmath.poly.univar.BasicPolynomial.iterbases(), nzmath.poly.multivar.BasicPolynomial.iterbases(), nzmath.poly.univar.BasicPolynomial.itercoefficients(), nzmath.poly.multivar.BasicPolynomial.itercoefficients(), nzmath.poly.univar.BasicPolynomial.iterterms(), nzmath.poly.multivar.BasicPolynomial.iterterms(), and nzmath.poly.univar.BasicPolynomial.square().
|
private |
Definition at line 199 of file multivar.py.
Referenced by nzmath.poly.multivar.BasicPolynomial.__call__(), nzmath.poly.multivar.BasicPolynomial.combine_similar_terms(), nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.erase_variable(), nzmath.poly.univar.SortedPolynomial.scalar_mul(), nzmath.poly.univar.BasicPolynomial.square(), nzmath.poly.multivar.BasicPolynomial.square(), and nzmath.poly.uniutil.KaratsubaProvider.square_karatsuba().
nzmath.poly.multivar.BasicPolynomial.number_of_variables |
Definition at line 193 of file multivar.py.
Referenced by nzmath.poly.ring.PolynomialRing.__eq__(), nzmath.poly.ring.RationalFunctionField.__eq__(), nzmath.poly.ring.PolynomialRing.__hash__(), nzmath.poly.ring.RationalFunctionField.__hash__(), nzmath.poly.ring.PolynomialRing.__repr__(), nzmath.poly.ring.RationalFunctionField.__repr__(), nzmath.poly.ring.PolynomialRing.__str__(), nzmath.poly.ring.RationalFunctionField.__str__(), nzmath.poly.ring.PolynomialRing._constant_polynomial(), nzmath.poly.ring.PolynomialRing._prepared_polynomial(), nzmath.poly.ring.PolynomialRing._zero_polynomial(), nzmath.poly.multivar.BasicPolynomial.erase_variable(), nzmath.poly.ring.PolynomialRing.getCommonSuperring(), nzmath.poly.ring.RationalFunctionField.getCommonSuperring(), nzmath.poly.ring.PolynomialRing.getQuotientField(), nzmath.poly.ratfunc.RationalFunction.getRing(), nzmath.poly.ring.PolynomialRing.issubring(), nzmath.poly.ring.RationalFunctionField.issubring(), nzmath.poly.ring.PolynomialRing.issuperring(), nzmath.poly.ring.RationalFunctionField.issuperring(), nzmath.poly.multiutil.RingElementProvider.set_coefficient_ring(), and nzmath.poly.ring.RationalFunctionField.unnest().