[poincare] Expression::getLinearCoefficients: the constant coefficient

has to be reduced before returned
This commit is contained in:
Émilie Feral
2018-06-12 15:05:48 +02:00
parent bb3a1a4ff1
commit c5cc871841

View File

@@ -257,7 +257,10 @@ bool Expression::getLinearCoefficients(char * variables, Expression * coefficien
index++;
}
*constant = new Opposite(equation, false);
// xy = 0?
Reduce(constant, context);
/* The expression can be linear on all coefficients taken one by one but
* non-linear (ex: xy = 2). We delete the results and return false if one of
* the coefficients contains a variable. */
bool isMultivariablePolynomial = (*constant)->recursivelyMatches(dependsOnVariables, context);
for (int i = 0; i < index; i++) {
if (isMultivariablePolynomial) {