lib/simplifyExpression/collectAndCombineSearch/multiplyLikeTerms.js
// coefficients is handled in collecting like terms for multiplication)
coefficients is handled in collecting like terms for multiplication)
coefficients is handled in collecting like terms for multiplication )
function multiplyLikeTerms(node, polynomialOnly=false) {
  if (!Node.Type.isOperator(node)) {
    return Node.Status.noChange(node);
  }
  let status;
  if (!polynomialOnly && !checks.canMultiplyLikeTermConstantNodes(node)) {
    status = arithmeticSearch(node);
    if (status.hasChanged()) {
      status.changeType = ChangeTypes.MULTIPLY_COEFFICIENTS;
      return status;
    }
    status = multiplyFractionsSearch(node);
    if (status.hasChanged()) {
      status.changeType = ChangeTypes.MULTIPLY_COEFFICIENTS;
      return status;
    }
  }
  status = multiplyPolynomialTerms(node);
  if (status.hasChanged()) {
    status.changeType = ChangeTypes.MULTIPLY_COEFFICIENTS;
    return status;
  }
  status = multiplyNthRoots(node);
  if (status.hasChanged()) {
    return status;
  }
  return Node.Status.noChange(node);
}
function multiplyLikeTerms ( node , polynomialOnly = false ) { if ( ! Node . Type . isOperator ( node ) ) { return Node . Status . noChange ( node ) ; } let status ; if ( ! polynomialOnly && ! checks . canMultiplyLikeTermConstantNodes ( node ) ) { status = arithmeticSearch ( node ) ; if ( status . hasChanged ( ) ) { status . changeType = ChangeTypes . MULTIPLY_COEFFICIENTS ; return status ; } status = multiplyFractionsSearch ( node ) ; if ( status . hasChanged ( ) ) { status . changeType = ChangeTypes . MULTIPLY_COEFFICIENTS ; return status ; } } status = multiplyPolynomialTerms ( node ) ; if ( status . hasChanged ( ) ) { status . changeType = ChangeTypes . MULTIPLY_COEFFICIENTS ; return status ; } status = multiplyNthRoots ( node ) ; if ( status . hasChanged ( ) ) { return status ; } return Node . Status . noChange ( node ) ; }
coefficients is handled in collecting like terms for multiplication)
coefficients is handled in collecting like terms for multiplication )