|   | 1 |  initial version  | 
The variables you are trying to use in K are not in R. To have them there define R as a polynomial ring in your variables like:
k_vars = [ ["k_{}_{}".format(u,v) for v in (1..2)] for u in (1..2) ]
R = PolynomialRing(IntegerModRing(22), sum(k_vars,[]) )
K = matrix(R, k_vars)
|   | 2 |  No.2 Revision  | 
The variables you are trying to use in K are not in its ring R. To have them there Also, it's better to avoid dealing with symbolic ring (i.e. defining variables via var) whenever possible. A better way here is to define R as a polynomial ring in your variables like:
k_vars = [ ["k_{}_{}".format(u,v) for v in (1..2)] for u in (1..2) ]
R = PolynomialRing(IntegerModRing(22), sum(k_vars,[]) )
K = matrix(R, k_vars)
|   | 3 |  No.3 Revision  | 
The variables you are trying to use in K are not in its ring R. Also, it's better to avoid dealing with symbolic ring (i.e. defining variables via var) whenever possible. A better way here is to define R as a polynomial ring in your variables like:
k_vars = [ ["k_{}_{}".format(u,v) for v in (1..2)] for u in (1..2) ]
 R = PolynomialRing(IntegerModRing(22), sum(k_vars,[]) )
R._latex_names = sum( [["k_{{{},{}}}".format(u,v) for v in (1..2)] for u in (1..2)], [] )
K = matrix(R, k_vars)
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.