id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
18419,Extend truncation of polynomials and harmonize with __getitem__,vdelecroix,,"The current `truncate` methods of polynomials is
{{{
cpdef truncate(self, n):
r""""""
return self modulo X^n
""""""
}}}
In many algorithms it is desirable to have a more general truncation
{{{
cpdef truncate(self, l, h):
r""""""
Given a polynomial p = a_0 + a_1 X + ... + a_d X^d return the polynomial
a_l + a_{l+1} X + ... + a_{h-1] X^h
""""""
}}}
It would be the very same semantic than for the `__getitem__`.
{{{
sage: R. = QQ[]
sage: p = 0 + 1*x + 2*x^2 + 3*x^3 + 4*x^4
sage: p[1:3]
2*x^2 + x
sage: p[2:]
4*x^4 + 3*x^3 + 2*x^2
}}}
Currently the `__getitem__` method is a generic one. But for slices of the form `(a,b,1)` we should rely on `truncate` that can be optimized in derived classes.",enhancement,new,major,sage-6.7,algebra,,,,,,,N/A,,,,,