Ask Your Question

Revision history [back]

That's not a bug, your matrix is simply not invertible. You can see it by switching the ring to SR to perform exact computations:

test_S_SR = matrix(SR, 5)
for ix in range(0, 5):
    for iy in range(0, 5):
        test_S_SR[ix, iy] = sin(ix+iy)*sin(iy+1)

sage: test_S_SR.determinant().trig_reduce() # can take a few seconds
0

The float version looks invertible but that's only due to machine precision. Since the internal mechanism are probably different for RR and CC, it's normal that you get different answers.

That's not a bug, your matrix is simply not invertible. You can see it by switching the ring to SR to perform exact computations:

test_S_SR = matrix(SR, 5)
for ix in range(0, 5):
    for iy in range(0, 5):
        test_S_SR[ix, iy] = sin(ix+iy)*sin(iy+1)

$$
\left(\begin{array}{rrrrr} 0 & \sin\left(2\right) \sin\left(1\right) & \sin\left(3\right) \sin\left(2\right) & \sin\left(4\right) \sin\left(3\right) & \sin\left(5\right) \sin\left(4\right) \ \sin\left(1\right)^{2} & \sin\left(2\right)^{2} & \sin\left(3\right)^{2} & \sin\left(4\right)^{2} & \sin\left(5\right)^{2} \ \sin\left(2\right) \sin\left(1\right) & \sin\left(3\right) \sin\left(2\right) & \sin\left(4\right) \sin\left(3\right) & \sin\left(5\right) \sin\left(4\right) & \sin\left(6\right) \sin\left(5\right) \ \sin\left(3\right) \sin\left(1\right) & \sin\left(4\right) \sin\left(2\right) & \sin\left(5\right) \sin\left(3\right) & \sin\left(6\right) \sin\left(4\right) & \sin\left(7\right) \sin\left(5\right) \ \sin\left(4\right) \sin\left(1\right) & \sin\left(5\right) \sin\left(2\right) & \sin\left(6\right) \sin\left(3\right) & \sin\left(7\right) \sin\left(4\right) & \sin\left(8\right) \sin\left(5\right) \end{array}\right) $$

sage: test_S_SR.determinant().trig_reduce() # can take a few seconds
0

The float version looks invertible but that's only due to machine precision. Since the internal mechanism are probably different for RR and CC, it's normal that you get different answers.

That's not a bug, your matrix is simply not invertible. You can see it by switching the ring to SR to perform exact computations:

test_S_SR = matrix(SR, 5)
for ix in range(0, 5):
    for iy in range(0, 5):
        test_S_SR[ix, iy] = sin(ix+iy)*sin(iy+1)
sage: test_S_SR

$$
[ 0 sin(2)*sin(1) sin(3)*sin(2) sin(4)*sin(3) sin(5)*sin(4)] [ sin(1)^2 sin(2)^2 sin(3)^2 sin(4)^2 sin(5)^2] [sin(2)*sin(1) sin(3)*sin(2) sin(4)*sin(3) sin(5)*sin(4) sin(6)*sin(5)] [sin(3)*sin(1) sin(4)*sin(2) sin(5)*sin(3) sin(6)*sin(4) sin(7)*sin(5)] [sin(4)*sin(1) sin(5)*sin(2) sin(6)*sin(3) sin(7)*sin(4) sin(8)*sin(5)] \left(\begin{array}{rrrrr} 0 & \sin\left(2\right) \sin\left(1\right) & \sin\left(3\right) \sin\left(2\right) & \sin\left(4\right) \sin\left(3\right) & \sin\left(5\right) \sin\left(4\right) \ \sin\left(1\right)^{2} & \sin\left(2\right)^{2} & \sin\left(3\right)^{2} & \sin\left(4\right)^{2} & \sin\left(5\right)^{2} \ \sin\left(2\right) \sin\left(1\right) & \sin\left(3\right) \sin\left(2\right) & \sin\left(4\right) \sin\left(3\right) & \sin\left(5\right) \sin\left(4\right) & \sin\left(6\right) \sin\left(5\right) \ \sin\left(3\right) \sin\left(1\right) & \sin\left(4\right) \sin\left(2\right) & \sin\left(5\right) \sin\left(3\right) & \sin\left(6\right) \sin\left(4\right) & \sin\left(7\right) \sin\left(5\right) \ \sin\left(4\right) \sin\left(1\right) & \sin\left(5\right) \sin\left(2\right) & \sin\left(6\right) \sin\left(3\right) & \sin\left(7\right) \sin\left(4\right) & \sin\left(8\right) \sin\left(5\right) \end{array}\right) $$

sage: test_S_SR.determinant().trig_reduce() # can take a few seconds
0

The float version looks invertible but that's only due to machine precision. Since the internal mechanism are probably different for RR and CC, it's normal that you get different answers.