numpoly.monomial#
- numpoly.monomial(start: ArrayLike, stop: ArrayLike | None = None, dimensions: int = 1, cross_truncation: ArrayLike = 1.0, graded: bool = False, reverse: bool = False, allocation: int | None = None) ndpoly[source]#
Create an polynomial monomial expansion.
- Args:
- start:
The minimum polynomial to include. If int is provided, set as lowest total order. If array of int, set as lower order along each indeterminant.
- stop:
The maximum shape included. If omitted:
stop <- start; start <- 0If int is provided, set as largest total order. If array of int, set as largest order along each indeterminant.- dimensions:
The indeterminants names used to create the monomials expansion. If int provided, set the number of names to be used.
- cross_truncation:
The hyperbolic cross truncation scheme to reduce the number of terms in expansion. In other words, it sets the \(q\) in the \(L_q\)-norm.
- graded:
Graded sorting, meaning the indices are always sorted by the index sum. E.g.
q0**2*q1**2*q2**2has an exponent sum of 6, and will therefore be consider larger than bothq0**3*q1*q2,q0*q1**2*q2andq0*q1*q2**2, which all have exponent sum of 5.- reverse:
Reverse lexicographical sorting meaning that
q0*q1**3is considered bigger thanq0**3*q1, instead of the opposite.- allocation:
The maximum number of polynomial exponents. If omitted, use length of exponents for allocation.
- Return:
Monomial expansion.
- Example:
>>> numpoly.monomial(4) polynomial([1, q0, q0**2, q0**3]) >>> numpoly.monomial(start=4, stop=5, dimensions=2, ... graded=True, reverse=True) polynomial([q1**4, q0*q1**3, q0**2*q1**2, q0**3*q1, q0**4]) >>> numpoly.monomial(2, [3, 4], graded=True) polynomial([q0**2, q0*q1, q1**2, q1**3]) >>> numpoly.monomial( ... start=0, ... stop=4, ... dimensions=("q2", "q4"), ... cross_truncation=0.5, ... graded=True, ... reverse=True, ... ) polynomial([1, q4, q2, q4**2, q2**2, q4**3, q2**3])