Ask Your Question

# Revision history [back]

You define a bunch of variables named x_1-1...y_3_3, as well the t3 list of expressions ... but fail to define x andy.

BTW : x[j, i] is not a valid Python expression ; you probably meanx[j][i]...

Possible suggestions (with some lightening...) :

Xs = matrix([[var("x_%s_%s"%(u, v), latex_name="x_{%s,%s}"%(u, v))
for v in range(1, 4)]
for u in range(1, 4)])
Ys = matrix([[var("y_%s_%s"%(u, v), latex_name="y_{%s,%s}"%(u, v))
for v in range(1, 4)]
for u in range(1, 4)])
t3=[x_1_1*x_1_2*x_2_3/((x_1_1 + 1)*(x_2_3 + 1)),
x_2_1*(x_3_1 + 1)/(x_1_1*x_2_1*x_3_1 + x_1_1*x_2_1 + x_1_1 + 1),
(x_1_1 + 1)/(x_1_1*x_2_1*(x_3_1 + 1)),
1/x_2_3,
(x_3_1*x_3_2 + x_3_1 + 1)*(x_1_1 + 1)*x_2_2*(x_2_3 + 1)/(x_3_1 + 1),
(x_1_1*x_2_1*x_3_1 + x_1_1*x_2_1 + x_1_1 + 1)*x_3_2/\
((x_3_1*x_3_2 + x_3_1 + 1)*(x_1_1 + 1)),
x_1_3*(x_2_3 + 1),
x_2_3*x_3_1*x_3_2*x_3_3/((x_3_1*x_3_2 + x_3_1 + 1)*(x_2_3 + 1)),
(x_3_1 + 1)/(x_3_1*x_3_2)]
va = Xs.list() ## Or possibly va=Xs.transpose().list()
a1 = Ys.list() ## Ditto. You're not overly clear...
a3 = list(map(lambda a, b:a-b, t3, a1))
Sol = solve(a3, va)


Meta-suggestion : read a Python tutorial (zillions of them) and this excellent book.

HTH,