Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend truncation of polynomials and harmonize with __getitem__ #18419

Open
videlec opened this issue May 14, 2015 · 0 comments
Open

Extend truncation of polynomials and harmonize with __getitem__ #18419

videlec opened this issue May 14, 2015 · 0 comments

Comments

@videlec
Copy link
Contributor

videlec commented May 14, 2015

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.<x> = 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.

Component: algebra

Issue created by migration from https://trac.sagemath.org/ticket/18419

@videlec videlec added this to the sage-6.7 milestone May 14, 2015
@mkoeppe mkoeppe removed this from the sage-6.7 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants