diff --git a/poincare/src/addition.cpp b/poincare/src/addition.cpp index 05eb97101..11f0fc709 100644 --- a/poincare/src/addition.cpp +++ b/poincare/src/addition.cpp @@ -389,11 +389,25 @@ Expression Addition::factorizeOnCommonDenominator(ExpressionNode::ReductionConte Power inverseDenominator = Power::Builder(commonDenominator, Rational::Builder(-1)); Multiplication result = Multiplication::Builder(numerator, inverseDenominator); + /* To simplify the numerator and the denominator, we allow symbolic + * computation: all unwanted symbols should have already disappeared by now, + * and if we checked again for symbols we might find "paramter" symbols + * disconnected from the parametered expression, which would be replaed with + * undef. + * Example: int((ℯ^(-x))-x^(0.5), x, 0, 3), when creating the common + * denominator for the integrand. */ + ExpressionNode::ReductionContext contextWithSymbolicComputation = ExpressionNode::ReductionContext( + reductionContext.context(), + reductionContext.complexFormat(), + reductionContext.angleUnit(), + reductionContext.target(), + true); + // Step 4: Simplify the numerator - numerator.shallowReduce(reductionContext); + numerator.shallowReduce(contextWithSymbolicComputation); // Step 5: Simplify the denominator (in case it's a rational number) - inverseDenominator.deepReduce(reductionContext); + inverseDenominator.deepReduce(contextWithSymbolicComputation); /* Step 6: We simplify the resulting multiplication forbidding any * distribution of multiplication on additions (to avoid an infinite loop).