MCPcopy
hub / github.com/keon/algorithms / variables

Method variables

algorithms/math/polynomial.py:568–578  ·  view source on GitHub ↗

Get all variable indices present in this polynomial. Returns: A set of variable indices.

(self)

Source from the content-addressed store, hash-verified

566 return Polynomial(list({m.clone() for m in self.all_monomials()}))
567
568 def variables(self) -> set:
569 """Get all variable indices present in this polynomial.
570
571 Returns:
572 A set of variable indices.
573 """
574 res = set()
575 for i in self.all_monomials():
576 res |= {j for j in i.variables}
577 res = list(res)
578 return set(res)
579
580 def all_monomials(self) -> Iterable[Monomial]:
581 """Get all non-zero monomials in this polynomial.

Callers 3

subsMethod · 0.95
poly_long_divisionMethod · 0.80

Calls 1

all_monomialsMethod · 0.95

Tested by 1