]> www.ginac.de Git - ginac.git/commitdiff
[BUGFIX] Fix a bug in normal() method.
authorVladimir V. Kisil <V.Kisilv@leeds.ac.uk>
Sun, 8 Aug 2021 14:01:46 +0000 (16:01 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Sun, 8 Aug 2021 14:01:46 +0000 (16:01 +0200)
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.

ginac/normal.cpp

index 818aa808159a1789c7d577a3f3e7f6b4a6e0ea36..2dd2ac3e55b349aeae799e30f3f77589f6515a93 100644 (file)
@@ -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<function>(e_replaced) && is_ex_the_function(e_replaced, exp)) {
                for (auto & it : repl) {
-                       if (is_a<function>(it.second) && is_ex_the_function(e_replaced, exp)) {
+                       if (is_a<function>(it.second) && is_ex_the_function(it.second, exp)) {
                                ex ratio = normal(e_replaced.op(0) / it.second.op(0));
                                if (is_a<numeric>(ratio) && ex_to<numeric>(ratio).is_rational()) {
                                        // Different exponents can be treated as powers of the same basic equation