mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/poincare] Use symbolicComputation in recursivelyMatches
This fixes a failed assertion for the scenario: [3]->x then, in the Equation app, solve x+1->0
This commit is contained in:
@@ -15,7 +15,7 @@ using namespace Shared;
|
||||
namespace Solver {
|
||||
|
||||
bool Equation::containsIComplex(Context * context) const {
|
||||
return expressionClone().recursivelyMatches([](const Expression e, Context * context) { return e.type() == ExpressionNode::Type::Constant && static_cast<const Constant &>(e).isIComplex(); }, context, true);
|
||||
return expressionClone().recursivelyMatches([](const Expression e, Context * context) { return e.type() == ExpressionNode::Type::Constant && static_cast<const Constant &>(e).isIComplex(); }, context);
|
||||
}
|
||||
|
||||
Expression Equation::Model::standardForm(const Storage::Record * record, Context * context, bool replaceFunctionsButNotSymbols) const {
|
||||
@@ -44,8 +44,7 @@ Expression Equation::Model::standardForm(const Storage::Record * record, Context
|
||||
[](const Expression e, Context * context) {
|
||||
return e.type() == ExpressionNode::Type::Undefined || e.type() == ExpressionNode::Type::Infinity || Expression::IsMatrix(e, context);
|
||||
},
|
||||
contextToUse,
|
||||
true))
|
||||
contextToUse))
|
||||
{
|
||||
*returnedExpression = Undefined::Builder();
|
||||
} else if (expressionRed.type() == ExpressionNode::Type::Equal) {
|
||||
|
||||
@@ -156,7 +156,7 @@ EquationStore::Error EquationStore::privateExactSolve(Poincare::Context * contex
|
||||
}
|
||||
|
||||
const Expression e = eq->standardForm(context, replaceFunctionsButNotSymbols); // The standard form is memoized so there is no double computation even if replaceFunctionsButNotSymbols is true.
|
||||
if (e.isUninitialized() || e.type() == ExpressionNode::Type::Undefined) {
|
||||
if (e.isUninitialized() || e.type() == ExpressionNode::Type::Undefined || e.recursivelyMatches(Expression::IsMatrix, context, replaceFunctionsButNotSymbols ? ExpressionNode::SymbolicComputation::ReplaceDefinedFunctionsWithDefinitions : ExpressionNode::SymbolicComputation::ReplaceAllDefinedSymbolsWithDefinition)) {
|
||||
return Error::EquationUndefined;
|
||||
}
|
||||
if (e.type() == ExpressionNode::Type::Unreal) {
|
||||
|
||||
Reference in New Issue
Block a user