class_docstr: A simple Monomial class to
  record the details of all variables
  that a typical monomial is composed of.
class_docstr_tok: ["A","simple","Monomial","class","to","record","the","details","of","all","variables","that","a","typical","monomial","is","composed","of","."]
docstr: Create a monomial in the given variables:
  Examples:
  
      Monomial({1:1}) = (a_1)^1
  
      Monomial({
          1:3,
          2:2,
          4:1,
          5:0
      }, 12) = 12(a_1)^3(a_2)^2(a_4)
  
      Monomial({}) = 0
  
      Monomial({2:3, 3:-1}, 1.5) = (3/2)(a_2)^3(a_3)^(-1)
docstr_tok: ["Create","a","monomial","in","the","given","variables",":","Examples",":","Monomial","(","{","1:1","}",")","=","(","a_1",")","^1","Monomial","(","{","1:3",",","2:2",",","4:1",",","5:0","}",",","12",")","=","12","(","a_1",")","^3","(","a_2",")","^2","(","a_4",")","Monomial","(","{","}",")","=","0","Monomial","(","{","2:3",",","3",":","-1","}",",","1.5",")","=","(","3\/2",")","(","a_2",")","^3","(","a_3",")","^","(","-1",")"]
code: def __init__(
      self,
      variables: Dict[int, int],
      coeff: Union[int, float, Fraction, None] = None,
  ) -> None:
      """
      Create a monomial in the given variables:
      Examples:
  
          Monomial({1:1}) = (a_1)^1
  
          Monomial({
              1:3,
              2:2,
              4:1,
              5:0
          }, 12) = 12(a_1)^3(a_2)^2(a_4)
  
          Monomial({}) = 0
  
          Monomial({2:3, 3:-1}, 1.5) = (3/2)(a_2)^3(a_3)^(-1)
  
      """
      self.variables = dict()
  
      if coeff is None:
          if len(variables) == 0:
              coeff = Fraction(0, 1)
          else:
              coeff = Fraction(1, 1)
      elif coeff == 0:
          self.coeff = Fraction(0, 1)
          return
  
      if len(variables) == 0:
          self.coeff = Monomial._rationalize_if_possible(coeff)
          return
  
      for i in variables:
          if variables[i] != 0:
              self.variables[i] = variables[i]
      self.coeff = Monomial._rationalize_if_possible(coeff)
  
imports: from fractions import Fraction
  from typing import Dict, Union, Set, Iterable
  from numbers import Rational
  from functools import reduce
label_desc: Use image node_id 1 to create a new Monomial object  with example: obj = Monomial(variables, coeff)