some problem with determinant of a matrix

Messages in english

Modérateur : xcasadmin

jocaps
Messages : 119
Inscription : lun. avr. 17, 2017 4:32 pm

some problem with determinant of a matrix

Message par jocaps » lun. févr. 18, 2019 10:12 am

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

lukamar
Messages : 331
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: some problem with determinant of a matrix

Message par lukamar » lun. févr. 18, 2019 11:12 am

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

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: some problem with determinant of a matrix

Message par parisse » lun. févr. 18, 2019 4:39 pm

Yes, running det(exact(m)) is a good workaround. I will avoid interpolation for det of these kinds of matrices in the future...

jocaps
Messages : 119
Inscription : lun. avr. 17, 2017 4:32 pm

Re: some problem with determinant of a matrix

Message par jocaps » mar. févr. 19, 2019 4:34 am

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.

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: some problem with determinant of a matrix

Message par parisse » mar. févr. 19, 2019 8:10 am

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.

Répondre