code: def cycle_product(m1: Monomial, m2: Monomial) -> Monomial:
      """
      Given two monomials (from the
      cycle index of a symmetry group),
      compute the resultant monomial
      in the cartesian product
      corresponding to their merging.
      """
      assert isinstance(m1, Monomial) and isinstance(m2, Monomial)
      A = m1.variables
      B = m2.variables
      result_variables = dict()
      for i in A:
          for j in B:
              k = lcm(i, j)
              g = (i * j) // k
              if k in result_variables:
                  result_variables[k] += A[i] * B[j] * g
              else:
                  result_variables[k] = A[i] * B[j] * g
  
      return Monomial(
          result_variables, Fraction(m1.coeff * m2.coeff, 1)
      )
  
file_path: keon-algos/algorithms/maths/symmetry_group_cycle_index.py
imports: from fractions import Fraction
  from typing import Dict, Union
  from polynomial import Monomial, Polynomial
  from gcd import lcm
label_desc: Use image node_id 1 for calling a global function with example usage: cycle_product(m1, m2) and returns: Monomial