How to solve a symbolic matrix equation det(A)=0

7 views (last 30 days)
How to solve a symbolic matrix equation det(A)=0 in Matlab.
I have symbolic matrix A (6*6) with 7 symbolic variables (a1, a2, a3, a4, a5, a6, a7). How to obtain singular solutions depending on the symbolic variables?
  2 Comments
John D'Errico
John D'Errico on 7 Apr 2015
There are infinitely many such constants that will solve that problem, and we have not yet even seen the matrix.
Vladimir
Vladimir on 8 Apr 2015
Edited: Walter Roberson on 20 Sep 2015
Here is my second problem. Symbolic matrix is J. Variables are t1 t2 t3 t4 t5 t6, while a2 d1 d4 d6 are known variables. How to solve the symbolic matrix equation det(J)=0 in Matlab. The result should be obtained in relation to the angles: t1 t2 t3 t4 t5 t6.
syms t1 t2 t3 t4 t5 t6
syms a2 d1 d4 d6
z0=[0,0,1];
px=d6*(sin(t5)*(cos(t4)*cos(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))-sin(t1)*sin(t4))+cos(t5)*cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3)))+d4*cos(t4)*cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))+a2*sin(t2)*cos(t1);
py=d6*(sin(t5)*(cos(t4)*sin(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))-cos(t1)*sin(t4))+cos(t5)*sin(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3)))+d4*cos(t4)*sin(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))+a2*sin(t2)*sin(t1);
pz=d6*(-sin(t5)*cos(t4)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))+cos(t5)*(cos(t2)*cos(t3)-sin(t2)*sin(t3)))+d4*(cos(t2)*cos(t3)-sin(t2)*sin(t3))+a2*cos(t2)+d1;
p=[px, py, pz];
z1=[0,0,1];
p1=[0,0,0];
z2=[cos(t1)*sin(t2),sin(t1)*sin(t2),cos(t2)];
p2=[0,0,d1];
z3=[cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3)),sin(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3)),(cos(t2)*cos(t3)-sin(t2)*sin(t3))];
p3=[cos(t1)*sin(t2)*a2,0,cos(t2)*a2+d1];
p0=[0,0,0];
pz0=p'-p0';
jp1=cross(z0',pz0);
pz1=p'-p1';
jp2=cross(z1',pz1);
pz2=p'-p2';
jp3=cross(z2',pz2);
pz3=p'-p3';
jp4=cross(z3',pz3);
z4=[cos(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4);sin(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))*cos(t4)-sin(t1)*sin(t4);(cos(t2)*cos(t3)-sin(t2)*sin(t3))];
p4=[cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))*d4+cos(t1)*sin(t2)*a2;sin(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))*d4+a2*sin(t1)*sin(t2);(cos(t2)*cos(t3)-sin(t2)*sin(t3))*d4+cos(t2)*a2+d1];
pz4=p'-p4;
jp5=cross(z4,pz4);
z5=[sin(t5)*(cos(t4)*cos(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))-sin(t1)*sin(t4))-cos(t5)*cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3));sin(t5)*(cos(t4)*sin(t1)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))-sin(t1)*sin(t4))-cos(t5)*sin(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3));-sin(t5)*cos(t4)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))-cos(t5)*(cos(t2)*cos(t3)-sin(t2)*sin(t3))];
p5=[d4*cos(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))+a2*sin(t2)*cos(t1);d4*sin(t1)*(sin(t2)*cos(t3)+cos(t2)*sin(t3))+a2*sin(t1)*sin(t2);d4*(cos(t2)*cos(t3)-sin(t2)*sin(t3))+a2*cos(t2)+d1];
pz5=p'-p5;
jp6=cross(z5,pz5);
jo1=z0;
jo1=z0';
jo2=z1';
jo3=z2';
jo4=z3';
jo5=z4;
jo6=z5;
jp=[jp1,jp2,jp3,jp4,jp5,jp6];
jo=[jo1,jo2,jo3,jo4,jo5,jo6];
J=[jp;jo]

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 8 Apr 2015
Edited: John D'Errico on 8 Apr 2015
Even without thinking about the matrix in question, THERE ARE INFINITELY MANY SOLUTIONS. Infinity is a BIG number.
But why not try something yourself? Pick any value of the parameters t1, t2, t3, t4, t5. ANY value. Substitute in for those values.
Then see what happens.
J1 = subs(J,{t1,t2,t3,t4,t5},[1 2 3 4 5]);
det(J1)
ans =
0
So, I picked some subset of those parameters, set them to arbitrary, non-zero values, and the determinant is identically zero. Maybe this tells you something? I wonder what are the odds that I happened to pick some set of numbers that make the problem trivially solvable?
So maybe I just happened to get lucky and pick some set of numbers with a special property? So lets see how lucky is MATLAB.
J1 = subs(J,{t1,t2,t3,t4,t5},rand(1,5));
det(J1)
ans =
0
Ok, so let me pick only 4 of those parameters to set randomly.
J1 = subs(J,{t1,t2,t3,t5},rand(1,4));
det(J1)
ans =
0
How about 3 of them?
J1 = subs(J,{t2,t3,t5},rand(1,3));
det(J1)
ans =
0
J1 = subs(J,{t4,t6},rand(1,2));
det(J1)
ans =
0
How about picking just ONE parameter to set?
J1 = subs(J,{t5},rand(1));
det(J1)
ans =
0
I surely am lucky today. Who would ever have thought I could be so lucky, to keep picking such arbitrary sets of numbers, and find the determinant was always identically zero?
Gosh, I should run out and buy a lottery ticket. Or, possibly, there is something about this matrix that makes it singular. Somehow, I don't think the lottery ticket idea is as good as the alternative.
det(J)
ans =
0
Oh. Maybe that is why I got so lucky?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!