[GiNaC-list] normal() bug-or-feature
Christian Bauer
Christian.Bauer at uni-mainz.de
Thu Nov 18 13:52:03 CET 2004
Hi!
On Tue, Nov 09, 2004 at 10:10:07PM +0300, Sheplyakov Alexei wrote:
> symbol m1("m1");
> symbol m2("m2");
> symbol x("x");
> ex e1 = pow(x,2)*pow(m1,2) - pow(x,2)*pow(m2,2);
> ex e2 = pow(pow(x,2)*pow(m1,2)-pow(x,2)*pow(m2,2),100);
> ex ca, cb, gc;
> gc = gcd(e1, e2, &ca, &cb, false);
> cout << c2 << endl;
> // this won't be just x^198*(m1^2-m2^2)^99.
> // (m1^2-m2^2)^99 gets expanded.
> cout << (e1/e2).normal() << endl;
> // won't print just x^(-198)*(m1^2-m2^2)^(-99),
> // (m1^2-m2^2)^99 gets expanded
Hm, which version of GiNaC are you using? I'm getting ca = 1,
cb = (-m2^2*x^2+m1^2*x^2)^99, and e1/e2 gets simplified to
(-m2^2*x^2+m1^2*x^2)^(-99) by power::eval() even before normal()
is invoked. Besides, gcd() already has heuristics for the cases
b==a^n (or a==b^n).
Bye,
Christian
--
/ Physics is an algorithm
\/ http://www.uni-mainz.de/~bauec002/
More information about the GiNaC-list
mailing list