Skip to content

Unexpected behavior of unused_vars #368

@thomas-sturm

Description

@thomas-sturm

Consider:

>>> c = fmpq_mpoly_ctx.get(('x'))
>>> x = c.gen(0)
>>> one = x - x + 1
>>> one.unused_gens()
('x',)

In contrast:

>>> zero = x - x
>>> zero.unused_gens()
()

This is quite unexpected. The documentation of unused_gens specifies that "a generator is unused if it’s maximum degree is 0":

>>> one.degrees()
(0,)
>>> zero.degrees()
(-1,)

Strictly speaking, zero.unused_gens meets this specification. However, it might be more natural to change the specification to "at most 0" (or explicitly point at the special case 0 in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions