Context
Consider a polynomial in $d$ variables of degree $N>1$. When $d=1$, it is a well-established fact that such a polynomial can be expressed as a product of polynomials, each of degree 1. However, for $d>1$, this is no longer the case. A $d$-variate polynomial of degree $N$ can be decomposed into a product of irreducible polynomials, with the sum of their degrees equating to $N$. To elucidate the structure of these irreducible components, we introduce the following notation:
A partition of $N$ is denoted by $\lambda = (1^{m_1}, \ldots, \lambda_1^{m_{\lambda_1}})$, where $m_i$ represents the number of irreducible polynomials of degree $i$ in the decomposition of $P$.
A multipartition of $l(\lambda)$ into $N$ components is denoted by $\mu = (\mu^{(1)}, \ldots, \mu^{(N)})$, where each component $\mu^{(i)}$ is itself a partition of $m_i$, representing the multiplicities of the irreducible polynomials of degree $i$ in the decomposition of $P$.
The concatenation of the partition $\lambda$ and its associated multipartition $\mu$ is written as $\lambda_{\mu}$.
Definition
We now define the generalized coincident root locus, denoted by $X_{\lambda_\mu}$, associated with a partition $\lambda$ and a multipartition $\mu$ as follows. For $\lambda \vdash N$ and $\mu \vdash_N l(\lambda)$ with $\mu^{(i)} \vdash m_i(\lambda)$, $X_{\lambda_\mu}$ is the set of all polynomials that decompose into irreducible components in accordance with $\lambda_\mu$:
$X_{\lambda_\mu}\equiv $
$ \{ P \in \mathbb{C}[x_0,...,x_{d-1}]_N ~|~ P=\prod_{i=1}^{l(\lambda)} \prod_{j=1}^{l(\mu^{(i)})} P_{i,j}^{\mu_{i,j}} \text{, with } P_{\alpha,\beta} \in \mathbb{C}[x_0,...,x_{d-1}]_\alpha,~ \beta \in \mathbb{N}\}$
where the $P_{\alpha,\beta}$ are irreducible and distinct.
Challenge
The primary objective is to construct the set $X_{\lambda_\mu}$ in Macaulay2, with the aim of determining the ideal $I = I(X_{\lambda_\mu})$ and computing a Gröbner basis for this ideal. Guidance and methodologies for implementing this in Macaulay2 are sought, as I am at the preliminary stage of familiarity with Macaulay2.
Nb : Should there be an alternative tool that facilitates a more streamlined approach than Macaulay2, and provided that you are adept at utilizing this alternative for a comprehensive response, I would deem such a response to be acceptable.
Example
To fix ideas, let the irreducible decomposition of a $d$-variate polynomial $P$ of degree 12 reads $P=P_{1,1}^2\cdot P_{2,1} \cdot P_{2,2}^2 \cdot P_{4,1}$, where $P_{i,j}$ denotes the $j$-th degree $i$ polynomial constituting the irreducible decomposition of $P$. The associated $\lambda_{\mu}$ reads $(1^2,2^3,4^1)_{((2),(1,2),(1))}$. Therefore, $P\in X_{\lambda_\mu}$.