Interacting not only for the value but before for the dimensions

asked 2024-01-18 13:53:07 +0100

Cyrille gravatar image

The following code, which is the answer to the question https://ask.sagemath.org/question/30156/how-to-use-matrices-with-interact/ is nice

@interact
def _(m = input_grid(2,2, default = [[1,7],[3,4]], label='M=', to_value=matrix)):
    print(m)
    print(m.eigenvalues())

But I wonder if it could be possible to modify it to cope with arbitrary dimension (First you must say what are the dimension of the grid. And secondly suppose that what interest you is a multiplication, how to enter 2 or tree matrices in the same way before realize the operation.

edit retag flag offensive close merge delete

Comments

Please give us the reason why this question is relevant to sage. (The code does in sage specifically only the story with the eigenvalues, else we have a pythonic level of work.)

And if it is relevant, for instance for the case of the multiplication of nine (to be interactively given) matrices of dimension $17\times 17$ (to not have odder more specific dimensions like $17\times 18$, $18\times 1234$, ... $56\times 8756$, $8756\times 198$ - to not mention the need of also declaring the field to work in, maybe some function field over $\Bbb F_{101}$ in 3 variables that must be 'a,epsilon,X', where the latex echos in prints should use alpha$=\alpha$, varepsilon$=\varepsilon$, and $X$), how should the operator give the input of these nine matrices? Why not give all the story in code?

dan_fulea gravatar imagedan_fulea ( 2024-01-22 20:58:28 +0100 )edit