
Re: Linear System in Mathematica  Solve returns only the zero vector (though there are more solutions)
Posted:
May 17, 2013 2:38 AM


Am 16.05.2013 11:46, schrieb Dino: > Hey guys, > say I want to find the null space of this matrix (which I define as 'Tbl'): > {{c, 1/2, 0}, {0, 1 + c, 1}, {0, 1/2, 3 + c}} > > I try this: > Solve[Tbl.{x, y, z} == {0, 0, 0}, {x, y, z}] > and I get this: > {{x > 0, y > 0, z > 0}} > > But the zero vector is not the only solution. For example if I do this: > c = Sqrt[3/2]  2 > then > Solve[Tbl.{x, y, z} == {0, 0, 0}, {x, y, z}] > returns > {{x > (((2  Sqrt[6]) z)/(4 + Sqrt[6])), y > (2 + Sqrt[6]) z}} > which is closer to what I want. I actually want something like that with 'c' in it. (And then I have some other equation that I'll use to find the value of c. Btw, the matrix above is only an example. I actually care to find a solution to a whole range of matrices of larger and larger sizes.) > > Can anyone help? I guess I want to tell Mathematica somehow that c is some arbitrary constant and there may be more solutions, depending on the value of c. >
Use Reduce or Solve for c in Eigenvalues.
mat = {{c, 1/2, 0}, {0, 1 + c, 1}, {0, 1/2, 3 + c}}; expr = mat . {x, y, z} {c*x + y/2, (1 + c)*y + z, y/2 + (3 + c)*z}
(*Use Reduce to generate a logical Orlist of Andequations *)
rd = Reduce[(0 == #1 & ) /@ expr] (z == 0 && y == 0 && x == 0)  (z == 0 && y == 0 && x != 0 && c == 0)  ((y == 2*z  Sqrt[6]*z  y == 2*z + Sqrt[6]*z) && y != 0 && x == (13*y*z + 6*z^2)/(5*y) && x != 0 && c == (y/(2*x)))
(*Mapping an Assumption for Simplify into the OrList*)
(Assuming[#1, FullSimplify[expr]] & ) /@ rd {0, 0, 0}  {0, 0, 0}  {0, y + c*y + z, y/2 + (3 + c)*z}
(* for linear vector equations eliminate some vector components*)
el = Eliminate[(0 == #1 & ) /@ expr, {z, y}] c*(5 + 8*c + 2*c^2)*x == 0
(*and solve for the matrix parameter c *)
sol = Solve[el, c] {{c > 0}, {c > (1/2)*(4  Sqrt[6])}, {c > (1/2)*(4 + Sqrt[6])}}
(* replace c in expression and Solve for y,z as function of x*)
(Solve[((0 == #1 & ) /@ (expr /. sol))[[#1]], {y, z}] & ) /@ Range[3] {{{y > 0, z > 0}}, {{y > 4*x + Sqrt[6]*x, z > (1/2)*(2 + Sqrt[6])*(4*x + Sqrt[6]*x)}}, {{y > 4*x  Sqrt[6]*x, z > (1/2)*(2 + Sqrt[6])*(4*x + Sqrt[6]*x)}}}
(* Easiest method: get the eigensystem of mat*)
eg = Eigensystem[mat]
{{c, (1/2)*(4  Sqrt[6] + 2*c), (1/2)*(4 + Sqrt[6] + 2*c)}, {{1, 0, 0}, {((2  Sqrt[6])/(4 + Sqrt[6])), 2  Sqrt[6], 1}, {((2  Sqrt[6])/(4 + Sqrt[6])), 2 + Sqrt[6], 1}}}
(*Solve eigenvalue list for zero eigenvalues in parameter c*)
(Solve[eg[[1, #1]] == 0, c] & ) /@ Range[3] {{{c > 0}}, {{c > (1/2)*(4 + Sqrt[6])}}, {{c > (1/2)*(4  Sqrt[6])}}}
Hope it helps

Roland Franzius

