]> www.ginac.de Git - ginac.git/commit
Fix is_polynomial() so it works as advertised in the manual.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Thu, 6 Nov 2008 14:51:28 +0000 (17:51 +0300)
committerAlexei Sheplyakov <varg@theor.jinr.ru>
Thu, 6 Nov 2008 14:51:28 +0000 (17:51 +0300)
commit398f4eb2273a8a6adfe54361aa98cce12fe70174
tree4f3889f5efc5cc41094ccc6d83a94ef2a0a90ed9
parentff083aed45d1b4d488c5a90cb47dd6cdefffbcc8
Fix is_polynomial() so it works as advertised in the manual.

GiNaC manual says:
"Testing whether an expression is a polynomial in one or more variables
can be done with the method

 bool ex::is_polynomial(const ex & vars) const;
In the case of more than one variable, the variables are given as a list.

(x*y*sin(y)).is_polynomial(x)        // Returns true.
(x*y*sin(y)).is_polynomial(lst(x,y)) // Returns false."

However, the implementation is a bit inconsistent, as GiNaC reports
sin(x) + 2*s     is a polynomial in s, but
pow(2,x) + 2*s   is not a polynomial in s.

This patch fixes the inconsistency. Thanks to Jonathan Cross for reporting
this bug.
check/Makefile.am
check/check_is_polynomial.cpp [new file with mode: 0644]
ginac/power.cpp