Hi,

While using sympy-0.7.1.win32 to find the determinant of a 9x9 size
matrix, the following code just gives me []:

from sympy import *
from sympy.matrices import *
x, s = symbols('x,s')
M = Matrix([[1,3*x,2*x,5*x,7*x,7*x,4*x,6*x,5*x],[1/(3*x),1,x/2,3*x,5*x,
3*x,5*x,3*x,3*x],[1/(2*x),2/x,1,3*x,6*x,3*x,6*x,5*x,5*x],[1/(5*x),1/
(3*x),1/(3*x),1,6*x,2*x,4*x,3*x,3*x],[1/(7*x),1/(5*x),1/(6*x),1/(6*x),
1,x/5,x/2,x/3,x/3],[1/(7*x),1/(3*x),1/(3*x),1/(2*x),5/x,1,3*x,2*x,2*x],
[1/(4*x),1/(5*x),1/(6*x),1/(4*x),2/x,1/(3*x),1,x,x/3],[1/(6*x),1/(3*x),
1/(5*x),1/(3*x),3/x,1/(2*x),1/x,1,x],[1/(5*x),1/(3*x),1/(5*x),1/(3*x),
3/x,1/(2*x),3/x,1/x,1]])
s = M.det()
s
solve(s)

The below Matlab code I have actually used both produces the symbolic
determinant and its solution making the determinant = 0:

>> [1   3*x     2*x     5*x     7*x     7*x     4*x     6*x     5*x
1/(3*x) 1       x/2     3*x     5*x     3*x     5*x     3*x     3*x
1/(2*x) 2/x     1       3*x     6*x     3*x     6*x     5*x     5*x
1/(5*x) 1/(3*x) 1/(3*x) 1       6*x     2*x     4*x     3*x     3*x
1/(7*x) 1/(5*x) 1/(6*x) 1/(6*x) 1       x/5     x/2     x/3     x/3
1/(7*x) 1/(3*x) 1/(3*x) 1/(2*x) 5/x     1       3*x     2*x     2*x
1/(4*x) 1/(5*x) 1/(6*x) 1/(4*x) 2/x     1/(3*x) 1       x       x/3
1/(6*x) 1/(3*x) 1/(5*x) 1/(3*x) 3/x     1/(2*x) 1/x     1       x
1/(5*x) 1/(3*x) 1/(5*x) 1/(3*x) 3/x     1/(2*x) 3/x     1/x     1]

ans =

[     1,   3*x,   2*x,   5*x,   7*x,   7*x,   4*x,   6*x,   5*x]
[ 1/3/x,     1, 1/2*x,   3*x,   5*x,   3*x,   5*x,   3*x,   3*x]
[ 1/2/x,   2/x,     1,   3*x,   6*x,   3*x,   6*x,   5*x,   5*x]
[ 1/5/x, 1/3/x, 1/3/x,     1,   6*x,   2*x,   4*x,   3*x,   3*x]
[ 1/7/x, 1/5/x, 1/6/x, 1/6/x,     1, 1/5*x, 1/2*x, 1/3*x, 1/3*x]
[ 1/7/x, 1/3/x, 1/3/x, 1/2/x,   5/x,     1,   3*x,   2*x,   2*x]
[ 1/4/x, 1/5/x, 1/6/x, 1/4/x,   2/x, 1/3/x,     1,     x, 1/3*x]
[ 1/6/x, 1/3/x, 1/5/x, 1/3/x,   3/x, 1/2/x,   1/x,     1,     x]
[ 1/5/x, 1/3/x, 1/5/x, 1/3/x,   3/x, 1/2/x,   3/x,   1/x,     1]

>> A=ans

A =

[     1,   3*x,   2*x,   5*x,   7*x,   7*x,   4*x,   6*x,   5*x]
[ 1/3/x,     1, 1/2*x,   3*x,   5*x,   3*x,   5*x,   3*x,   3*x]
[ 1/2/x,   2/x,     1,   3*x,   6*x,   3*x,   6*x,   5*x,   5*x]
[ 1/5/x, 1/3/x, 1/3/x,     1,   6*x,   2*x,   4*x,   3*x,   3*x]
[ 1/7/x, 1/5/x, 1/6/x, 1/6/x,     1, 1/5*x, 1/2*x, 1/3*x, 1/3*x]
[ 1/7/x, 1/3/x, 1/3/x, 1/2/x,   5/x,     1,   3*x,   2*x,   2*x]
[ 1/4/x, 1/5/x, 1/6/x, 1/4/x,   2/x, 1/3/x,     1,     x, 1/3*x]
[ 1/6/x, 1/3/x, 1/5/x, 1/3/x,   3/x, 1/2/x,   1/x,     1,     x]
[ 1/5/x, 1/3/x, 1/5/x, 1/3/x,   3/x, 1/2/x,   3/x,   1/x,     1]


>> det(A)

ans =

1/68040000/
x^7*(220449600*x^14-1886068800*x^13+8102639520*x^12-22674790980*x^11+44475384828*x^10-65346108188*x^9+79077332921*x^8-83067498684*x^7+71729961960*x^6-46617691095*x^5+22014521575*x^4-7596140900*x^3+1857714250*x^2-284550000*x
+21000000)

>> solve(ans)

ans =

                                        .
49392530579267874366477298620162
                                        .
68607861848591739263438236067199
 
1.4196246448783615212397879138998
 
1.9485057898549110972454340032617
    1.1340390809741388389995399152253+.
46228008343584832122605447632043*i
    .22104987835554992382046134671970+.
14086715024698162643184561077195*i
    .
95466432759790434570198072089475+2.0841859632376755920542773940758*i
 .86308735644910184513831015409445e-1+.
37573309931082667607442258912743*i
   -.
39235142430065989265022385248892+1.0529792538101967691779585678336*i
   -.
39235142430065989265022385248892-1.0529792538101967691779585678336*i
 .86308735644910184513831015409445e-1-.
37573309931082667607442258912743*i
    .
95466432759790434570198072089475-2.0841859632376755920542773940758*i
    .22104987835554992382046134671970-.
14086715024698162643184561077195*i
    1.1340390809741388389995399152253-.
46228008343584832122605447632043*i

I'd appreciate if you could tell me where I am making a mistake in
Sympy?

Best,
Tll

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to