lib/util/flattenOperands.js
// an expression tree with root node * and children 2*2 and x
an expression tree with root node * and children 2*2 and x
an expression tree with root node * and children 2 * 2 and x
function isPolynomialTermMultiplication(node) {
  if (node.op !== '*') {
    return false;
  }
  if (node.args.length !== 2) {
    return false;
  }
  const secondOperand = node.args[1];
  if (Node.PolynomialTerm.isPolynomialTerm(secondOperand)) {
    const polyNode = new Node.PolynomialTerm(secondOperand);
    return !polyNode.hasCoeff();
  }
  else {
    return false;
  }
}
function isPolynomialTermMultiplication ( node ) { if ( node . op !== '*' ) { return false ; } if ( node . args . length !== 2 ) { return false ; } const secondOperand = node . args [ 1 ] ; if ( Node . PolynomialTerm . isPolynomialTerm ( secondOperand ) ) { const polyNode = new Node . PolynomialTerm ( secondOperand ) ; return ! polyNode . hasCoeff ( ) ; } else { return false ; } }
an expression tree with root node * and children 2*2 and x
an expression tree with root node * and children 2 * 2 and x
// This concept only applies when we're flattening multiplication operations // This only makes sense when we're flattening two arguments // The second node should be for the form x or x^2 (ie a polynomial term // with no coefficient)