# mpmath matrix commands integers sage vs python

I import mpmath into sage by

`import mpmath as mp`

then I try to create an identity matrix by

`mp.eye(3)`

but this does not work, it raises the error

TypeError: could not interpret given arguments

rather I have to tell mpmath that indeed 3 is an integer, so

`mp.eye(int(3))`

does work. Also raising mpmath matrix M to a power has the same problem

`M^3`

does not work. Again I have to do

`M^(int(3))`

why is this the case? can that be circumvented somehow? ("eye(3)" does work in python)

Sage has a preparser that wrap integers with

`Integer(...)`

. Try "preparse(4)" to see what it does.One could view this as a bug in

`mpmath`

, since at least some basic Python functions (for example`range`

) can handle Sage integers as inputs just fine. So using`Integer(3)`

should not be an obstacle, but I guess`mpmath`

has not implemented this.