From 44842e8f4f771a58b4d2e00469b82813c5c67646 Mon Sep 17 00:00:00 2001
From: "Vladimir V. Kisil" <V.Kisilv@leeds.ac.uk>
Date: Sun, 1 Aug 2021 23:38:25 +0100
Subject: [PATCH 1/2] Fix a bug in normal() method

Any function was confused with an exponent of the same argument
during a normalisation of an expression.

Signed-off-by: Vladimir V. Kisil <V.Kisilv@leeds.ac.uk>
---
 ginac/normal.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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<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
-- 
2.30.2

