ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 26 Apr 2018 01:23:53 +0200Sage wont solve simultaneous equationhttps://ask.sagemath.org/question/42174/sage-wont-solve-simultaneous-equation/I tried asking this question earlier, but my profile still says I have asked 0 questions. I have tried solving this problem in different ways, but this is the closest I have gotten;
var('a b c d e f g h i')
X=matrix(3,3,[[0,1,0],[0,0,1],[1,0,0]])
P=matrix(3,3,[[a,b,c],[d,e,f],[g,h,i]])
Pdagger=P.transpose()
Xdagger=X.transpose()
Q=X*Pdagger
B=Q.solve_left(X)
eqns=[]
xlist=[]
for i in range(0,3):
for j in range(0,3):
eqns.append(B[i][j])
xlist.append(X[i][j])
final=[]
for k in range(0,9):
final.append(eqns[k]==xlist[k])
show(final)
sol=solve(eqns,[a,b,c,d,e,f,g,h,i])
show(sol)
I know there is a solution to this problem, and it is the identity, $PXP^{\dagger}=X$.
But the output:
Error in lines 19-19
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 976, in solve
raise TypeError("%s is not a valid variable." % repr(i))
TypeError: 2 is not a valid variable.
There is also probably a much more efficient way of specifying the problem, but I don't understand why this wont work. I would like to extend this problem to larger matrices as well, so autonomy is welcomed. However, I would appreciate any advice just on getting this error fixed.PatrickLewisThu, 26 Apr 2018 01:23:53 +0200https://ask.sagemath.org/question/42174/