protected final void compute() {
    // Sum[{x^2,x^3}]

    int n = truncate == null ? geoList.size() : (int) truncate.getDouble();

    if (n == 0 || n > geoList.size()) {
      resultFun.setUndefined();
      return;
    } else if (n == 1) {
      if (!geoList.get(0).isGeoFunctionable()) {
        resultFun.setUndefined();
        return;
      }

      GeoFunction fun1 = ((GeoFunctionable) geoList.get(0)).getGeoFunction();

      FunctionVariable x1 = fun1.getFunction().getFunctionVariable();
      FunctionVariable x = new FunctionVariable(kernel);

      ExpressionNode left = fun1.getFunctionExpression().getCopy(fun1.getKernel());

      Function f = new Function(left.replace(x1, x), x);

      resultFun.setFunction(f);
      resultFun.setDefined(true);
      return;
    }

    if (!geoList.get(0).isGeoFunctionable() || !geoList.get(1).isGeoFunctionable()) {
      resultFun.setUndefined();
      return;
    }

    // add first two:
    resultFun =
        GeoFunction.add(
            resultFun,
            ((GeoFunctionable) geoList.get(0)).getGeoFunction(),
            ((GeoFunctionable) geoList.get(1)).getGeoFunction());

    if (n == 2) return;

    for (int i = 2; i < n; i++) {

      if (!geoList.get(i).isGeoFunctionable()) {
        resultFun.setUndefined();
        return;
      }
      resultFun =
          GeoFunction.add(
              resultFun, resultFun, ((GeoFunctionable) geoList.get(i)).getGeoFunction());
    }
  }