[patch] small improvement of collect_common_factors
Hello! This ginsh code snippet: collect_common_factors(x/y + z/y^2); returns the original expression unchanged: z*y^(-2)+x*y^(-1) The patch below makes it return (x+z*y^(-1))*y^(-1) Index: normal.cpp =================================================================== RCS file: /home/cvs/GiNaC/ginac/normal.cpp,v retrieving revision 1.94.2.8 diff -u -r1.94.2.8 normal.cpp --- normal.cpp 30 Jun 2005 14:03:16 -0000 1.94.2.8 +++ normal.cpp 10 Mar 2006 13:40:26 -0000 @@ -2388,6 +2388,8 @@ { if (exponent.info(info_flags::posint)) return power(basis.to_rational(repl), exponent); + else if (exponent.info(info_flags::negint)) + return power(replace_with_symbol(power(basis, _ex_1), repl), -exponent); else return replace_with_symbol(*this, repl); } Best regards, Alexei. -- All science is either physics or stamp collecting.
participants (2)
-
Chris Dams
-
varg@theor.jinr.ru