series expansion once again...
Sheplyakov Alexei
varg at thsun1.jinr.ru
Mon Apr 5 15:11:39 CEST 2004
Hello!
> Series expansion now works predictably. All terms with the exponent
> of the expansion variable smaller than the given order are
> calculated exactly. If the series is not terminating, the Order
> function is (at least) of the given order.
( GiNaC 1.1.7 changelog )
That sounds nice, but let's consider a simple program.
#include <iostream>
#include <stdexcept>
using namespace std;
#include <ginac/ginac.h>
using namespace GiNaC;
int main(int argc, char** argv) {
try {
symbol eps("epsilon");
ex part1 = tgamma(2-eps)*pow(eps, -1)*pow(tgamma(3-eps), -1);
ex part2 = tgamma(2-eps)*pow(eps, 2)*pow(tgamma(3-eps), -1);
ex test = part1 + part2;
cout << test << " = " << test.series(eps, 1) << endl;
cout << part1 << " = " << part1.series(eps, 1) << endl;
cout << part2 << " = " << part2.series(eps, 1) << endl;
return 0;
}
catch ( exception & ee) {
cerr << ee.what() << endl;
return 1;
}
}
My naive expectations are:
1) first and second lines should be the same
2) third line should be Order(epsilon)
But the output is:
tgamma(2-epsilon)*tgamma(3-epsilon)^(-1)*epsilon^2+tgamma(2-epsilon)*tgamma(3-epsilon)^(-1)*epsilon^(-1) = Order(epsilon^(-1))
tgamma(2-epsilon)*tgamma(3-epsilon)^(-1)*epsilon^(-1) = 1/2*epsilon^(-1)+1/4+Order(epsilon)
tgamma(2-epsilon)*tgamma(3-epsilon)^(-1)*epsilon^2 = Order(epsilon^(-1))
Is this a bug or a feature?
Thanks,
Alexei.
P.S.
$ ginac-config --version
1.1.7
$ g++ --version | head -n 1
g++ (GCC) 3.3.3 (Debian 20040401)
More information about the GiNaC-list
mailing list