[GiNaC-list] Bug in expand

Isuru Fernando isuruf at gmail.com
Tue May 5 07:48:10 CEST 2015


Hi,

I modified the first benchmark at http://www.ginac.de/csSC-0004015.pdf to,

e = expanded value of  (a0 + a1 + sqrt(3)*a2 + sqrt(3)*a3 + ... +
sqrt(3)*a(n-1))^2

in e, substitute a0 with  -sqrt(3)*a2 - sqrt(3)*a3 - ... - sqrt(3)*a(n-1)

expand e again to obtain a1^2


For n = 4, I get,

 -3*a3^2+2*3*a2^2+a1^2-6*a2^2+3*a3^2

Or

3*a3^2-3*a2^2-3*a3^2+a1^2+3*a2^2

which is true, but not the expression I expected. Why are the terms 3*a2^2
and -3*a2^2, not canceled out immediately? Also a term like 2*3*a2^2 means
there is some bug right?

I am using ginac-1.6.3 on Ubuntu 14.10 with gcc-4.9.1. I am attaching the
sample program.


Isuru Fernando
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20150505/26dd20f3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_ginac.cpp
Type: text/x-c++src
Size: 468 bytes
Desc: not available
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20150505/26dd20f3/attachment.cpp>


More information about the GiNaC-list mailing list