Ask Your Question

Revision history [back]

It looks like the control module is restrictive, I would say too restrictive, on the classes it allows. The error arises in a function _clean_part, which starts

valid_types = (int, float, complex, np.number)

so it will not accept Sage integers, which have type sage.rings.integer.Integer. You can fix this by just using Python ints, and this has to be done either explicitly:

tf(int(1), [int(1), int(10), int(20)])

or by turning off Sage's preparser:

preparser(False)
tf(1, [1, 10, 20])

(The preparser automatically converts "7" to a Sage integer, it converts ^ to the exponentiation operator, and maybe does a few other things which are natural for a mathematical audience.)

It looks like the control module is restrictive, I would say too restrictive, on the classes it allows. The error arises in a function _clean_part, which starts

valid_types = (int, float, complex, np.number)

so it will not accept Sage integers, which have type sage.rings.integer.Integer. You can fix this by just using Python ints, and this has to be done either explicitly:

tf(int(1), [int(1), int(10), int(20)])

or by turning off Sage's preparser:

preparser(False)
tf(1, [1, 10, 20])

(The preparser automatically converts an integer like "7" to a Sage integer, it converts ^ to the exponentiation operator, and maybe does a few other things which are natural for a mathematical audience.)