Hi again, I am now convinced that what's in the subject is a bug. It is related to the assumption in the basic::collect function that this->ldegree(s) <= this->degree(s) but it is not always true:
ldegree(1/(1+x),x),degree(1/(1+x),x) (0, -1)
As a fix, the collect function should be ex basic::collect(const ex & s) const { ex x; int ldeg = this->ldegree(s); int deg = this->degree(s); int n_start = min(ldeg,deg); int n_end = max(ldeg,deg); for (int n=n_start; n<=n_end; n++) x += this->coeff(s,n)*power(s,n); return x; } Note that then
coeff(1/(1+x),x,0),coeff(1/(1+x),x,-1) (1 + x) ** (-1), 0
and consequently collect(1/(1+x),x) will result correctly in (1+x) ** (-1) Regards, Pearu On Thu, 12 Apr 2001, Pearu Peterson wrote:
Hi!
In ginsh (ginac V0.8.0):
x/(1+x); (1+x)^(-1)*x collect(x/(1+x),x); 0 <----??? collect(1+x/(1+x),x); 1 <----??? collect(x+x/(1+x),x); (1+(1+x)^(-1))*x
Is this GiNaC bug or feature?
Pearu
- To UNSUBSCRIBE, email to ginac-list@ginac.de with a subject of "unsubscribe".