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
Hi Isuru, On 05/05/2015 07:48 AM, Isuru Fernando wrote:
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.
Thank you for reporting this bug. It turns out to be a problem in expand(). It has nothing to do with subs(). I am attaching a preliminary patch. -richy. -- Richard B. Kreckel <http://in.terlu.de/~kreckel/>
participants (2)
-
Isuru Fernando
-
Richard B. Kreckel