Message Boards Message Boards

0
|
3044 Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

No output solving 3 equations in 3 variable using Solve[ ]?

Posted 2 years ago

POSTED BY: Shivank Kumar
6 Replies

Your equations are very poorly conditioned. The output can be meaningless:

{vector, matrix} = CoefficientArrays[{m1, m2, m3}, {x, y, z}];
matrix // Inverse
POSTED BY: Gianluca Gorni
Posted 2 years ago

If your problem is linear then this

{vector,matrix}=CoefficientArrays[{m1,m2,m3},{x,y,z}];
solution=LinearSolve[matrix,vector]

will extract your coefficients from your equations and solve the linear system without needing to know or use Rationalize or N, and this then displays x,y,z

{2.43756*^22,-2.94013*^20,-1.98547*^25}

and then this will substitute that solution into your 3x+2y expression

ReplaceAll[3x+2y,Thread[Rule[{x,y,z},solution]]]

which displays the result

7.25388*^22

If you manually extract the coefficients from your equations and or insert the solution into your expression then you could do this without needing to know most of these functions.

POSTED BY: Bill Nelson
Posted 2 years ago

Also if I want to use the ans and want to find the value of "3x+2y". It will simply show 3x+4y in output not calculate the numeric value of it

POSTED BY: Shivank Kumar

Try:

   eq = Rationalize[{m1, m2, m3}, 0];
   Solve[eq, {x, y, z}]

  (*{{x -> -(2986243790645883105455758358098195118556533001223336622172815\
  95320218030787297467003699784937656128630985195404293779345/
      122509485374294293794510320145189527584750827993252931995775611287\
  31463104731917954143845606655037), 
    y -> 360193320714837502461108755235814898426025986503897780740376984\
  7336638393825822545137993153228989027658267755878411291/
     1225094853742942937945103201451895275847508279932529319957756112873\
  1463104731917954143845606655037, 
    z -> 243238456696344063017037725294492493070825115410091835761432292\
  011917023278886765613559961661062168696584881661936232099735/
     1225094853742942937945103201451895275847508279932529319957756112873\
  1463104731917954143845606655037}}*)

  % // N(*Numeric solution:*)
  (*{{x -> -2.43756*10^22, y -> 2.94013*10^20, z -> 1.98547*10^25}}*)

Solve is symbolic solver need exact values.

POSTED BY: Mariusz Iwaniuk
Posted 2 years ago

Is there any direct command to solve these equations? If someone does not use the rationalize command.

POSTED BY: Shivank Kumar

Solve in general handles numeric values as well.

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

Group Abstract Group Abstract