Variable Matrices on Sage
I am using Sagemath 10. I wish to work with matrices whose entries are multivariate polynomial ring variables (nothing funky with the base ring, R = PolynomialRing(QQ, 100, 'x'); R.gens()
is what I am trying). I create a matrix.zero(n,n)
for reasonable n
(currently just 3) and then try to alter each entry manually. However, Sage complains that the entries can't be non-constant polynomials.
So I tried to provide the ring above as an argument by writing matrix.zero(R, n,n)
, but this generated the error
TypeError: unbound method Parent.category() needs an argument
I have also tried using M=MatrixSpace(R,n,n); M(L)
where L
is a list of appropriate design. It still complains about getting non-constant polynomial entries.
How do I circumvent this issue? I only plan to analyse the determinant of a specific kind of matrix. Based on this information, feel free to offer alternatives with more restricted functionality than just a matrix. Thank you!
like this
@FrédéricC : could you resend your comment as an answer (possibly with amplification/explanations ? This would be useful for the edification of future generations of this site users ;-)...
Before that, I must remark that it didn't resolve the issue. It complains about getting too many arguments. Which makes sense, because as far as I recall,
matrix()
takes in a list of lists and returns the corresponding matrix.You say "it complains". What command yields the complaint? The comment from @FrédéricC was intended (I believe) to address your first question: how to create a zero matrix that can be modified one entry at a time.
Okay, I am not sure what happened. The command
matrix(R,n,n)
seemed to be yielding this error. But when I ran the notebook today, stuff seems to be fine. As of this moment, I am unable to recover the original code I wrote which was causing issues. There is a small chance I just did not run the appropriate cells. Apologies.