| 1 | initial version |
There are several little problems in your code.
First you do not need to use SR in build_variables (avoid SR as much as possible when using polynomials). You can do
def build_variables(n):
names = []
for i in range(n):
for j in range(n):
names += ['x_' + str(i) + '_' + str(j)]
return(names)
Then in the lambda_siep function, you should only use the result my_variables of build_variables once, inside the PolynomialRing constructor.
Then you should not use my_variables anymore, but instead your X in the line
J[i,j] = derivative(Y[0][i], X[j][j])
The two lines
R.gens()
R.inject_variables()
are useless and can be removed. In particular, inject_variables is only to be used in interactive mode.
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.