Skip to content

Cannot divide by leading coefficient in non-integral domain #2

@user202729

Description

@user202729

If I do, for example,

R.<x, y> = Integers(6)[]
small_roots(x, (5, 5))

I get an error:

TypeError: self must be an integral domain.

(I'm not sure why it does not happen when N is a product of two large primes.)

Anyway, I think it's safer to modify the code as follows:

-	f /= f.coefficients().pop(0)
+	leading = 1 / f.coefficients().pop(0)
+	f = f.map_coefficients(lambda x: x * leading)

The code is functionally equivalent, and does not hit the aforementioned error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions