That does indeed seem simple. Here is an even shorter version that only 
needs one matrix.

R = LaurentPolynomialRing(QQ, "p1, p2, p3, p4, Q0, Q1, Q2, Q3, Q4, w, z") 
p1, p2, p3, p4, Q0, Q1, Q2, Q3, Q4, w, z = R.gens()

L = Matrix([[-p1, Q1, 0, 0, 0, -4*Q0/z, 0, 0, 0],
           [Q1, p1-p2, Q2, 0, 4*Q0/z, 0, 0, 0, 0],
           [0, Q2, p2-p3, Q3, 0, 0, 0, 0, 0],
           [0, 0, Q3, p3-2*p4, 0, 0, 0, 0, 2*Q4],
           [0, Q0*z, 0, 0, p1, -Q1, 0, 0, 0],
           [-Q0*z, 0, 0, 0, -Q1, -p1+p2, -Q2, 0, 0],
           [0, 0, 0, 0, 0, -Q2, -p2+p3, -Q3, 0],
           [0, 0, 0, 0, 0, 0, -Q3, -p3+2*p4, -Q4],
           [0, 0, 0, Q4, 0, 0, 0, -2*Q4, 0]])

print(f"Laurent: {L.det()}")
print(f"SR: {L.change_ring(SR).det().factor()}")

For me, the output is:
Laurent: 0 
SR: 4*Q0*Q1*Q2^2*Q3^2*Q4^2*p1*(z + 1)*(z - 1)/z 

I thought maybe the problem had something to do with L being singular, but 
adding the identity matrix to L doesn't solve the problem:

I = matrix.identity(9)
((L.change_ring(SR) + 42*I).det() - SR((L + 42*I).det())).factor()

Both individual determinants are a mess, but the difference I get is

4*Q0*Q1*Q2^2*Q3^2*Q4^2*(p1 - 42)*(z + 1)*(z - 1)/z

It is surprising to me that this is the same as the above determinant in 
SR, except for the 42.  And I get a similar answer if I replace 42 with a 
different constant, or even put in a variable by defining a polynomial ring 
over R.

I think a ticket should be opened.





On Thursday, December 17, 2020 at 3:18:02 PM UTC-7 Michael Orlitzky wrote:

> On 12/16/20 3:27 PM, Linden Disney wrote:
> > Ok I've modified the code to plain sage to make it more useful and I've 
> > copied it below. Given that it's hard to compare the determinants of the 
> > raw matrices, as they are defined in terms of different variables, I 
> > have found the z^2 coefficient in each case and you can see they are 
> > different. I've tested this in Sage 9.1 command line and this has worked.
> > 
>
> Great, thanks. I was able to simplify this even further... the 
> determinants still disagree at the L1/L2 stage, but look a lot nicer. 
> Maybe now someone can figure out what's going wrong. With these 
> definitions, you can even try (L1 == L2) and it returns True.
>
> p1, p2, p3, p4, Q0, Q1, Q2, Q3, Q4, w, z = SR.var("p1, p2, p3, p4, Q0, 
> Q1, Q2, Q3, Q4, w, z")
> L1 = Matrix([[-p1, Q1, 0, 0, 0, -4*Q0/z, 0, 0, 0],
> [Q1, p1-p2, Q2, 0, 4*Q0/z, 0, 0, 0, 0],
> [0, Q2, p2-p3, Q3, 0, 0, 0, 0, 0],
> [0, 0, Q3, p3-2*p4, 0, 0, 0, 0, 2*Q4],
> [0, Q0*z, 0, 0, p1, -Q1, 0, 0, 0],
> [-Q0*z, 0, 0, 0, -Q1, -p1+p2, -Q2, 0, 0],
> [0, 0, 0, 0, 0, -Q2, -p2+p3, -Q3, 0],
> [0, 0, 0, 0, 0, 0, -Q3, -p3+2*p4, -Q4],
> [0, 0, 0, Q4, 0, 0, 0, -2*Q4, 0]])
>
> L1.det()
>
>
> R = LaurentPolynomialRing(QQ, "p1, p2, p3, p4, Q0, Q1, Q2, Q3, Q4, w, z")
> p1, p2, p3, p4, Q0, Q1, Q2, Q3, Q4, w, z = R.gens()
>
> L2 = Matrix([[-p1, Q1, 0, 0, 0, -4*Q0/z, 0, 0, 0],
> [Q1, p1-p2, Q2, 0, 4*Q0/z, 0, 0, 0, 0],
> [0, Q2, p2-p3, Q3, 0, 0, 0, 0, 0],
> [0, 0, Q3, p3-2*p4, 0, 0, 0, 0, 2*Q4],
> [0, Q0*z, 0, 0, p1, -Q1, 0, 0, 0],
> [-Q0*z, 0, 0, 0, -Q1, -p1+p2, -Q2, 0, 0],
> [0, 0, 0, 0, 0, -Q2, -p2+p3, -Q3, 0],
> [0, 0, 0, 0, 0, 0, -Q3, -p3+2*p4, -Q4],
> [0, 0, 0, Q4, 0, 0, 0, -2*Q4, 0]])
>
> L2.det()
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/aa4c37a4-83fb-4437-9f45-510ee1f8dbe4n%40googlegroups.com.

Reply via email to