Page 1 sur 1

some problem with determinant of a matrix

Publié : lun. févr. 18, 2019 10:12 am
par jocaps
Consider the following code

Code : Tout sélectionner

m:=matrix[[0,0.425*v2,-0.425,0,0,-d5*l4+d5*l5,d5*l4*v5+d5*v5*l5],[0,0.425,0.425*v2,0,0,-d5*l4*v5-d5*v5*l5,-d5*l4+d5*l5],[0.425,0,0,-0.425*v2,d5*l4*l5*v5-d5*v5,0,0],[-2*v2,0,0,2,2*l4*l5*v5+2*v5,0,0],[0,-2*v2,-2,0,0,2*l4*v5-2*v5*l5,2*l4+2*l5],[0,2,-2*v2,0,0,-2*l4-2*l5,2*l4*v5-2*v5*l5],[-2,0,0,-2*v2,2*l4*l5-2,0,0]];
det(m);
I get Error: Bad Argument Value. I tried very hard to find out why this is happenning. So far I could not find the reason. The same matrix has a determinant in other computer algebra systems. If I replace the first row of the matrix by a zero row I get a determinant. I did not do more experiments to figure out the nature of this problem. But this is very peculiar. Any assistance is much appreciated.

Jose

Re: some problem with determinant of a matrix

Publié : lun. févr. 18, 2019 11:12 am
par lukamar
Hello Jose,
I think that mixing approx values with symbols is the problem here, but Bernard will know better. As a workaround, I propose applying "exact" before computing the determinant:

Code : Tout sélectionner

det(exact(m))
Luka

Re: some problem with determinant of a matrix

Publié : lun. févr. 18, 2019 4:39 pm
par parisse
Yes, running det(exact(m)) is a good workaround. I will avoid interpolation for det of these kinds of matrices in the future...

Re: some problem with determinant of a matrix

Publié : mar. févr. 19, 2019 4:34 am
par jocaps
Thank you Luka and Bernard. I guess I should have known better, I often encounter this and I always forget that at times I should switch to rationals. Maple has similar pecularities when you don't make your float rationals. In case you want to look at this more, I think that when working with less symbols (say only one) I did not get this error. No matter. I am switching to rationals for these kind of computations. Thanks a bunch.

Re: some problem with determinant of a matrix

Publié : mar. févr. 19, 2019 8:10 am
par parisse
jocaps a écrit :
mar. févr. 19, 2019 4:34 am
In case you want to look at this more, I think that when working with less symbols (say only one) I did not get this error.
There are several algorithms to compute determinants, if you don't select one explicitly, there is an heuristic to determine which one should be used and it depends on the number of variables and degrees.