Get all variable indices present in this polynomial. Returns: A set of variable indices.
(self)
| 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. |