Hi, maybe this is a bug, maybe combining "algebraic" and "no_pattern" is just not allowed. Here is the program: #include <iostream> #include <ginac.h> using namespace GiNaC; int main() { symbol x("x"); symbol y("y"); symbol A("A"); ex w(wild()); exmap repl; repl[w] = A; ex expr(x/y + w); ex result = expr.subs(repl, subs_options::algebraic | subs_options::no_pattern); std::cout << "Result: " << result << std::endl; return 0; } Expected output: x/y + A Actual output: A/y + A Apparently mul::algebraic_subs_mul() does not honour the no_pattern flag. ---------------- The practical reason why this problem arose is to achieve algebraic substitution in sums: #include <iostream> #include <ginac.h> using namespace GiNaC; int main() { symbol x("x"); symbol y("y"); symbol z("z"); symbol A("A"); symbol B("B"); ex w(wild()); exmap repl; repl[x + y + w] = A/B + w; ex expr = x + y + z; // Try to substitute x+y with A/B ex result = expr.subs(repl, subs_options::algebraic); std::cout << "Result: " << result << std::endl; return 0; } Expected output: A/B + z Actual output: z/B + z BTW, I noticed that expairseq::match() can do algebraic matching in sums. Why can it not be implemented for add::subs(), too? Regards, Jan