Message Boards Message Boards

How to choose desired solvable variables in Solve

Posted 3 months ago

POSTED BY: Izhak Manilov
5 Replies
Posted 3 months ago

Didn't expect so many fans! Thank you all guys

POSTED BY: Izhak Manilov

Maybe this is what you want (it's not very clear).

Solve[sys, Complement[al, ys], MaxExtraConditions -> 1]

(* During evaluation of In[8]:= Solve::svars: Equations may not give solutions for all "solve" variables.

Out[8]= {{x1 -> ConditionalExpression[y1 + y5, -1 + 2 y2 + y4 == 0], 
  x2 -> ConditionalExpression[(y3 + 2 y4 y5)/(
    2 y4), -1 + 2 y2 + y4 == 0], 
  x4 -> ConditionalExpression[(1 - y4)/2, -1 + 2 y2 + y4 == 0], 
  x5 -> ConditionalExpression[y3/(2 y4), -1 + 2 y2 + y4 == 0]}} *)
POSTED BY: Daniel Lichtblau
Posted 3 months ago

There is no x3 in your system.

That may be an error or it may be confusing Solve.

You can also try using Reduce instead of Solve. That will use different methods.

Either Solve or Reduce may work better when solving n equations for n variables.

POSTED BY: Bill Nelson
Posted 3 months ago

Thank you very much.May version 12 doesn't have this SolveValues .Howhever from your example i don't see how to chose specific vars ys, anyway i will trry different ways. thank's

POSTED BY: Izhak Manilov

You can try SolveValues instead of Solve:

sys = {-x1 + y1 + y5 == 0,
   -x4 + y2 == 0,
   y3 - 2  x5  y4 == 0,
   -1 + 2  x4 + y4 == 0,
   -x2 + x5 + y5 == 0};
al = {y1, y2, y3, y4, y5, x1, x2, x3, x4, x5};
SolveValues[sys, al]
Thread[al -> %[[1]]]
sys /. % // Simplify
POSTED BY: Gianluca Gorni
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