lib/simplifyExpression/collectAndCombineSearch/addLikeTerms.js
// If possible, adds together a list of nodes . Returns a Node.Status object.
If possible, adds together a list of nodes .
If possible adds together a list of nodes .
function addLikeTerms(node, polynomialOnly=false) {
  if (!Node.Type.isOperator(node)) {
    return Node.Status.noChange(node);
  }
  let status;
  if (!polynomialOnly) {
    status = evaluateConstantSum(node);
    if (status.hasChanged()) {
      return status;
    }
  }
  status = addLikePolynomialTerms(node);
  if (status.hasChanged()) {
    return status;
  }
  status = addLikeNthRootTerms(node);
  if (status.hasChanged()) {
    return status;
  }
  return Node.Status.noChange(node);
}
function addLikeTerms ( node , polynomialOnly = false ) { if ( ! Node . Type . isOperator ( node ) ) { return Node . Status . noChange ( node ) ; } let status ; if ( ! polynomialOnly ) { status = evaluateConstantSum ( node ) ; if ( status . hasChanged ( ) ) { return status ; } } status = addLikePolynomialTerms ( node ) ; if ( status . hasChanged ( ) ) { return status ; } status = addLikeNthRootTerms ( node ) ; if ( status . hasChanged ( ) ) { return status ; } return Node . Status . noChange ( node ) ; }
If possible, adds together a list of nodes .
If possible adds together a list of nodes .