Dear Jan,
Thank you for reporting the bug, I am attaching a patch which is
fixing it.
Best wishes,
Vladimir
--
Vladimir V. Kisil http://v-v-kisil.scienceontheweb.net
Book: Geometry of Mobius Maps https://doi.org/10.1142/p835
Soft: Geometry of cycles http://moebinv.sourceforge.net/
Jupyter notebooks: https://github.com/vvkisil?tab=repositories
>>>>> On Mon, 24 Aug 2026 18:37:23 +0200, Jan Rheinländer via GiNaC-list <ginac-list(a)ginac.de> said:
JR> Hi,
JR> maybe this is a bug, maybe combining "algebraic" and
JR> "no_pattern" is just not allowed. Here is the program:
JR> #include <iostream> #include <ginac.h> using namespace GiNaC;
JR> int main() { symbol x("x"); symbol y("y"); symbol A("A"); ex
JR> w(wild());
JR> exmap repl; repl[w] = A; ex expr(x/y + w);
JR> ex result = expr.subs(repl, subs_options::algebraic |
JR> subs_options::no_pattern);
JR> std::cout << "Result: " << result << std::endl;
JR> return 0; }
JR> Expected output: x/y + A
JR> Actual output: A/y + A
JR> Apparently mul::algebraic_subs_mul() does not honour the
JR> no_pattern flag.
JR> ----------------
JR> The practical reason why this problem arose is to achieve
JR> algebraic substitution in sums:
JR> #include <iostream> #include <ginac.h> using namespace GiNaC;
JR> int main() { symbol x("x"); symbol y("y"); symbol z("z"); symbol
JR> A("A"); symbol B("B"); ex w(wild());
JR> exmap repl; repl[x + y + w] = A/B + w;
JR> ex expr = x + y + z;
JR> // Try to substitute x+y with A/B ex result =
JR> expr.subs(repl, subs_options::algebraic);
JR> std::cout << "Result: " << result << std::endl;
JR> return 0; }
JR> Expected output: A/B + z
JR> Actual output: z/B + z
JR> BTW, I noticed that expairseq::match() can do algebraic matching
JR> in sums. Why can it not be implemented for add::subs(), too?
JR> Regards,
JR> Jan
Dear Jan,
Thank you for reporting the bug, I am attaching a patch which is
fixing it.
Best wishes,
Vladimir
--
Vladimir V. Kisil http://v-v-kisil.scienceontheweb.net
Book: Geometry of Mobius Maps https://doi.org/10.1142/p835
Soft: Geometry of cycles http://moebinv.sourceforge.net/
Jupyter notebooks: https://github.com/vvkisil?tab=repositories
>>>>> On Mon, 24 Aug 2026 18:37:23 +0200, Jan Rheinländer via GiNaC-list <ginac-list(a)ginac.de> said:
JR> Hi,
JR> maybe this is a bug, maybe combining "algebraic" and
JR> "no_pattern" is just not allowed. Here is the program:
JR> #include <iostream> #include <ginac.h> using namespace GiNaC;
JR> int main() { symbol x("x"); symbol y("y"); symbol A("A"); ex
JR> w(wild());
JR> exmap repl; repl[w] = A; ex expr(x/y + w);
JR> ex result = expr.subs(repl, subs_options::algebraic |
JR> subs_options::no_pattern);
JR> std::cout << "Result: " << result << std::endl;
JR> return 0; }
JR> Expected output: x/y + A
JR> Actual output: A/y + A
JR> Apparently mul::algebraic_subs_mul() does not honour the
JR> no_pattern flag.
JR> ----------------
JR> The practical reason why this problem arose is to achieve
JR> algebraic substitution in sums:
JR> #include <iostream> #include <ginac.h> using namespace GiNaC;
JR> int main() { symbol x("x"); symbol y("y"); symbol z("z"); symbol
JR> A("A"); symbol B("B"); ex w(wild());
JR> exmap repl; repl[x + y + w] = A/B + w;
JR> ex expr = x + y + z;
JR> // Try to substitute x+y with A/B ex result =
JR> expr.subs(repl, subs_options::algebraic);
JR> std::cout << "Result: " << result << std::endl;
JR> return 0; }
JR> Expected output: A/B + z
JR> Actual output: z/B + z
JR> BTW, I noticed that expairseq::match() can do algebraic matching
JR> in sums. Why can it not be implemented for add::subs(), too?
JR> Regards,
JR> Jan