mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[poincare] Expression::ExpressionWithoutSymbol does not take into
account SystemSymbol (UnknownX)
This commit is contained in:
@@ -70,6 +70,7 @@ public:
|
||||
return Expression();
|
||||
}
|
||||
// Symbol properties
|
||||
bool isSystemSymbol() const { return name()[0] == SpecialSymbols::UnknownX && name()[1] == 0; }
|
||||
static bool isSeriesSymbol(const char * c);
|
||||
static bool isRegressionSymbol(const char * c);
|
||||
bool matches(ExpressionTest test, Context & context) const;
|
||||
|
||||
@@ -226,6 +226,7 @@ void Expression::defaultSetChildrenInPlace(Expression other) {
|
||||
bool Expression::hasReplaceableSymbols(Context & context) const {
|
||||
return recursivelyMatches([](const Expression e, Context & context, bool replaceSymbols) {
|
||||
return (e.type() == ExpressionNode::Type::Symbol
|
||||
&& !static_cast<const Symbol &>(e).isSystemSymbol()
|
||||
&& !context.expressionForSymbol(static_cast<const Symbol &>(e)).isUninitialized())
|
||||
|| (e.type() == ExpressionNode::Type::Function
|
||||
&& !context.expressionForSymbol(static_cast<const Function &>(e)).isUninitialized());
|
||||
|
||||
@@ -204,6 +204,9 @@ int Symbol::getPolynomialCoefficients(Context & context, const char * symbolName
|
||||
}
|
||||
|
||||
Expression Symbol::replaceReplaceableSymbols(Context & context) {
|
||||
if (isSystemSymbol()) {
|
||||
return *this;
|
||||
}
|
||||
Expression e = context.expressionForSymbol(*this);
|
||||
if (e.isUninitialized()) {
|
||||
return *this;
|
||||
|
||||
Reference in New Issue
Block a user