Ask Your Question
4

Error with rational input in IntegerVectors

asked 2020-04-17 18:26:59 +0200

Johannes Schmitt gravatar image

updated 2020-04-19 00:25:31 +0200

slelievre gravatar image

I discovered the following unexpected behavior of IntegerVectors:

sage: IntegerVectors(2,3).list()
[[2, 0, 0], [1, 1, 0], [1, 0, 1], [0, 2, 0], [0, 1, 1], [0, 0, 2]]
sage: IntegerVectors(2,3/1).list()
[[2, 0, 0], [1, 1, 0]]

The relevant code block in the implementation of IntegerVectors seems to be the following:

    try:
        return IntegerVectors_nnondescents(n, tuple(k))
    except TypeError:
        pass

    return IntegerVectors_nk(n, k)

For k=3/1 one has that tuple(k) does not give a TypeError (as opposed to tuple(3)) and thus the code never tries to interpret k as an integer.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2020-04-17 21:23:07 +0200

vdelecroix gravatar image

updated 2020-04-19 12:04:26 +0200

Indeed. Thanks Johannes for the bug report (and the investigation)! I opened #29524 and proposed a fix there that was positively reviewed by Frédéric Chapoton. Hopefully, it will be in a next release of SageMath (either 9.1 or 9.2).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-17 18:26:59 +0200

Seen: 62 times

Last updated: Apr 19 '20