private static IExpr reduceFactorConstant(IExpr p, EvalEngine engine) { if (!engine.isNumericMode() && p.isPlus() && !engine.isTogetherMode()) { IExpr e = p; // ((reduceConstantTerm /@ (List @@ e)) // Transpose)[[1]] IExpr cTerms = F.Transpose .of(engine, F.Map(F.Function(F.unaryAST1(reduceConstantTerm, F.Slot1)), F.Apply(F.List, e))) .first(); // GCD @@ cTerms IExpr c = F.Apply.of(engine, F.GCD, cTerms); if (cTerms.last().isNegative()) { c = c.negate(); } return F.Times.of(engine, c, F.Distribute(F.Divide(e, c))); } return p; }
do { last = current; current = engine.evaluate(F.Apply(f, F.List(current)));
do { last = current; current = engine.evaluate(F.Apply(f, F.List(current))); if (iterationLimit >= 0 && iterationLimit <= ++iterationCounter) { IterationLimitExceeded.throwIt(iterationCounter, ast);
do { last = current; current = engine.evaluate(F.Apply(f, F.List(current))); list.append(current);