Ask Your Question

Revision history [back]

Testing if the entries of a matrix of rational vectors are actually integers

I moved from Python to SageMath because it allows me to deal with natural operations in mathematics without having to reinvent the wheel through typing obvious classes and methods. I also suppose the built-in classes and methods do things in more efficient ways that I could do myself.

However, sometimes I find hard to find the right function or class for what I want to do.

I have created several matrices using 'matrix' which may have rational or integer numbers (so I use QQ to define them). I want to check which matrices actually have all entries as integers. I know how to do this by looping through all entries of each matrix and calling 'is_integer', but is there an existing method in 'matrix' doing this for me? I could not find one.