From: Vladimir V. Kisil Date: Sun, 8 Aug 2021 14:01:46 +0000 (+0200) Subject: [BUGFIX] Fix a bug in normal() method. X-Git-Tag: release_1-8-1~2 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=11b9b59551913fc7cce475482548874504d9bf42;p=ginac.git [BUGFIX] Fix a bug in normal() method. Any function was confused with an exponent of the same argument during a normalisation of an expression. Example: normal(cos(x)/exp(x)) often returned 1 for realsymbol x. --- diff --git a/ginac/normal.cpp b/ginac/normal.cpp index 818aa808..2dd2ac3e 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -2072,7 +2072,7 @@ static ex replace_with_symbol(const ex & e, exmap & repl, exmap & rev_lookup, ls // they can be rationalised more efficiently if (is_a(e_replaced) && is_ex_the_function(e_replaced, exp)) { for (auto & it : repl) { - if (is_a(it.second) && is_ex_the_function(e_replaced, exp)) { + if (is_a(it.second) && is_ex_the_function(it.second, exp)) { ex ratio = normal(e_replaced.op(0) / it.second.op(0)); if (is_a(ratio) && ex_to(ratio).is_rational()) { // Different exponents can be treated as powers of the same basic equation