Group Abstract Group Abstract

Message Boards Message Boards

Determine solution of an underdetermined linear equation system

Posted 3 years ago

How can I get the same (i.e., a plane equation as) solution set of the linear system of equations in Mathematica as in Maple on the attached PDF (from a friend)?
Thanks in advance

Attachments:
POSTED BY: Nina Teller
5 Replies
POSTED BY: Mariusz Iwaniuk

Solution for an underdetermined system is not unique:

A = {{6, 3, 2, 3, 4}, {4, 2, 1, 2, 3}, {4, 2, 3, 2, 1}, {2, 1, 7, 3, 
    2}};
B = {5, 4, 0, 1};
ns = NullSpace[A];
x0 = Sum[C[i]*ns[[i]], {i, 1, Length[ns]}];
x1 = LinearSolve[A, B];
x1 + x0
A . % == B // Simplify (*Solution are: TRUE *)
(*{-(3/2) + 3 C[1] - C[2], 2 C[2], -2 + 4 C[1], 6 - 14 C[1], 4 C[1]}*)
(* TRUE *)

or:

Table[C[i], {i, 1, Length[A[[1]]]}] /. 
 Solve[A . Table[C[i], {i, 1, Length[A[[1]]]}] == B, 
  Table[C[i], {i, 1, Length[B]}], MaxExtraConditions -> All] // Expand
A . %[[1]] == B // Simplify (*Solution are: TRUE *)
(*{{C[1], -3 - 2 C[1] + (3 C[5])/2, -2 + C[5], 6 - (7 C[5])/2, C[5]}}*)
 (* TRUE *)

Maple 2022.2 solution: enter image description here

Regards M.I.

POSTED BY: Mariusz Iwaniuk

For first question:

 eqns = Thread[A . {c1, c2, c3, c4, c5} == B];
 {c1, c2, c3, c4, c5} /. Solve[eqns, {c1, c2, c3, c4}] (* Maybe simpler *)

For second question see here.

POSTED BY: Mariusz Iwaniuk
Posted 3 years ago

Thanks for your help! If you have time, maybe you could explain me the meaning of each input? From your answer and maybe from the one in the other block post:

m = {{1, 1, 1}, {1, 2, 3}, {1, 4, 9}};
b = {1, 2, 3};
abc = LinearSolve[m, b]
f = Dot[abc, {x, y, z}]
sol = Solve[f == 0, z]
Plot3D[z /. sol, {x, 0, 15}, {y, 0, 15}]

, because I would like to understand the system.

If you do not have time, it does not matter, because you have already helped me a lot!

POSTED BY: Nina Teller
Posted 3 years ago

Thanks for your answer! Is it possible to get this solution set with the parameters just using e.g. Solve[...] or so, why does it have to be so complicated?

Is there also a command for this, this matrix is represented as a plane equation? So: x=a+rb+tc (with r and t as parameters and x,a,b,c as vectors)

POSTED BY: Nina Teller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard