Expand the expression.
\large{(POL)}
SOLUTION.parsableText()
First use the distributive property.
(POL_1.coefs[index1] < 0) ? "-" : (n1 === 0 && n2 === 0) ? "" : "+"
abs(POL_1.coefs[index1]) === 1 ? "" : abs(POL_1.coefs[index1])
X^index1
((POL_2.coefs[index2] === 1) ? "" : (POL_2.coefs[index2] === -1) ? "-" : POL_2.coefs[index2]
X^index2)
Simplify.
(POL_1.coefs[index1] * POL_2.coefs[index2] < 0) ? "-" : (n1 === 0 && n2 === 0) ? "" : "+"
coefficient(abs(POL_1.coefs[index1] * POL_2.coefs[index2]))X^{index1 + index2}
SOLUTION
Identify like terms.
\color{LIKE_TERMS[index1 + index2 ]}
{(POL_1.coefs[index1] * POL_2.coefs[index2] < 0) ? "-" : (n1 === 0 && n2 === 0) ? "" : "+"
coefficient(abs(POL_1.coefs[index1] * POL_2.coefs[index2]))X^{index1 + index2}}
Add the coefficients.
\color{LIKE_TERMS[SOLUTION.getCoefAndDegreeForTerm(n).degree]}
{(SOLUTION.getCoefAndDegreeForTerm(n).coef < 0 || n === 0) ? "" : "+"
expr(SOLUTION.expr()[n + 1])}