[GiNaC-list] is_polynomial gives strange results

Florent Hivert florent.hivert at univ-rouen.fr
Thu May 19 23:35:29 CEST 2011


      Hi there,

I'm a regular user of GiNaC through PyNaC and Sage and I'm usually very happy
with it. Good work guys !

However during on of my class I was quite surprised by a result from
Sage. I've been able to trace back the result to GiNaC so I'd like to report
it here. Note that it's the first time I go into the arcane of GiNaC so I may
be wrong.

Here is a code that reproduce the problem:

#include <iostream>
#include <ginac/ginac.h>

using namespace std;
using namespace GiNaC;

int main()
{
  symbol x("x");
  ex poly;

  poly = sqrt(x*x+1)*sqrt(x+1);

  cout << poly << endl;
  cout << poly.is_polynomial(x) << endl;
  return 0;
}

The output is:

popcorn-*/Sage-Work/GiNaC $ ./ginac
sqrt(1+x)*sqrt(1+x^2)
1

so that sqrt(1+x)*sqrt(1+x^2) is considered as a polynomial in x !


Here are the standard info:

I just installed cln-1.3.2.tar.bz2 and ginac-1.5.8.tar.bz2 from the sources.

I'm using:

popcorn-~/install $ c++ --version
c++ (SUSE Linux) 4.5.0 20100604 [gcc-4_5-branch revision 160292]

In a

popcorn-~/install $ uname -a
Linux popcorn.rouba.net 2.6.34.7-0.7-desktop #1 SMP PREEMPT 2010-12-13 11:13:53 +0100 x86_64 x86_64 x86_64 GNU/Linux

Cheers,

Florent Hivert


More information about the GiNaC-list mailing list