[GiNaC-list] Re: [GiNaC-devel] Problem with power series

Chris.Dams at mi.infn.it Chris.Dams at mi.infn.it
Wed May 9 18:07:46 CEST 2007

Dear Stefan,

> can you briefly tell me what the problem is ?

Look at the file pseries.cpp. See:
http://www.ginac.de/viewcvs/GiNaC/ginac/pseries.cpp?rev=1.93&view=markup .
The method mul::pseries contains the code fragment.

int real_ldegree = 0;
try {
        real_ldegree = buf.expand().ldegree(sym-r.rhs());
} catch (std::runtime_error) {}

if (real_ldegree == 0) {
	int orderloop = 0;
	do {
		real_ldegree = buf.series(r, orderloop,
	} while (real_ldegree == orderloop);

The do ... while loop looks for the lowest degree for which the series is
nonzero. This is done for very factor in a product. Hence, if there is
never going to occur a term in the series that is nonzero, there is a

I would like to see a solution where there is besides a series method also
a method that returns the leading term, that may also return a result that
says that no leading term was found up to a certain order.

Best wishes,

More information about the GiNaC-list mailing list