lib/integral.js
function(expr, context, subIntegral) {
      if(expr.type === 'OperatorNode' && expr.op === '^') {
        if(expr.args[0].type === 'OperatorNode' && expr.args[0].op === '^') {
          return subIntegral(new OperatorNode('^', 'pow', [
            expr.args[0].args[0],
            new OperatorNode('*', 'multiply', [
              expr.args[0].args[1],
              expr.args[1]
            ])
          ]), context, 'removing double exponential');
        }
      }
    }
function(expr, context, subIntegral) {
      if(expr.type === 'OperatorNode' && expr.op === '^') {
        if(expr.args[0].type === 'OperatorNode' && expr.args[0].op === '^') {
          return subIntegral(new OperatorNode('^', 'pow', [
            expr.args[0].args[0],
            new OperatorNode('*', 'multiply', [
              expr.args[0].args[1],
              expr.args[1]
            ])
          ]), context, 'removing double exponential');
        }
      }
    }
function ( expr , context , subIntegral ) { if ( expr . type === 'OperatorNode' && expr . op === '^' ) { if ( expr . args [ 0 ] . type === 'OperatorNode' && expr . args [ 0 ] . op === '^' ) { return subIntegral ( new OperatorNode ( '^' , 'pow' , [ expr . args [ 0 ] . args [ 0 ] , new OperatorNode ( '*' , 'multiply' , [ expr . args [ 0 ] . args [ 1 ] , expr . args [ 1 ] ] ) ] ) , context , 'removing double exponential' ) ; } } }
integral((f(x) ^ g(x)) ^ h(x), x) = integral(f(x) ^ (g(x) * h(x)), x)
integral (( f ( x ) ^ g ( x )) ^ h ( x ) x ) = integral ( f ( x ) ^ ( g ( x ) * h ( x )) x )