Message Boards Message Boards

Solving a simple system of four equations gives no output

Posted 2 days ago

Greetings everyone!

A system of four equations is given:

In: sys={c1 == x1 x3, c2 == x1 x4, c3 == x2 x3, c4 == x2 x4}

Wolfram cannot solve this system of equations:

In: Solve[sys, {x1, x2, x3, x4}]
Out: {}

In: Solve[sys, {x1, x2, x3}]]
Out: {}

However, the system has a solution for x1, x2, x3 depending on x4 under the condition

c2 c3 == c1 c4

How can I get Wolfram to find this condition and get a solution for x1, x2, x3 under this condition?

POSTED BY: Sasha Mandra
3 Replies

you need to add c1,c2,c3,c4 to the variables

In[5]:= Reduce[{c1 == x1 x3, c2 == x1 x4, c3 == x2 x3, 
  c4 == x2 x4}, {c1, c2, c3, c4, x1, x2, x3, x4}]

Out[5]= (c1 == 0 && c2 == 0 && c3 == 0 && c4 == 0 && x1 == 0 && 
   x2 == 0) || (c1 != 0 && c4 == (c2 c3)/c1 && x2 == (c3 x1)/c1 && 
   x1 != 0 && x3 == c1/x1 && x4 == (c2 x3)/c1) || (c1 == 0 && 
   c2 == 0 && c3 == 0 && c4 == 0 && x1 != 0 && x3 == 0 && 
   x4 == 0) || (c1 == 0 && c2 == 0 && x1 == 0 && x2 != 0 && 
   x3 == c3/x2 && c3 != 0 && x4 == (c4 x3)/c3) || (c1 == 0 && 
   c3 == 0 && c2 != 0 && x2 == (c4 x1)/c2 && x3 == 0 && x1 != 0 && 
   x4 == c2/x1) || (c1 == 0 && c2 == 0 && c3 == 0 && c4 == 0 && 
   x1 == 0 && x2 != 0 && x3 == 0 && x4 == 0) || (c1 == 0 && c2 == 0 &&
    c3 == 0 && x1 == 0 && x3 == 0 && x2 != 0 && x4 == c4/x2 && 
   c4 != 0)
POSTED BY: Frank Kampas
Posted 2 days ago

Thank you very much!

POSTED BY: Sasha Mandra

Read up on the option MaxExtraConditions in the documentation for Solve[]. The default number is None, and Solve[] returns the solutions that require no extra conditions on the parameters. It's a bit hard to predict what you'll get by raising it. You mention one condition in particular, so let's try 1:

Solve[sys, {x1, x2, x3}, MaxExtraConditions -> 1]
(*
{{x1 -> ConditionalExpression[c2/x4, -c2 c3 + c1 c4 == 0], 
  x2 -> ConditionalExpression[(c2 c3)/(c1 x4), -c2 c3 + c1 c4 == 0], 
  x3 -> ConditionalExpression[(c1 x4)/c2, -c2 c3 + c1 c4 == 0]}}
*)

Simplify[%, c2 c3 == c1 c4]
(*
{{x1 -> c2/x4, x2 -> c4/x4, x3 -> (c1 x4)/c2}}
*)

That worked. If you let it do All, it will reduce the conditions as much as possible to cases consisting of combinations of v == value, v != value, v > value (if the parameter v is real), etc.

Solve[Append[sys, x4 != 0], {x1, x2, x3}, MaxExtraConditions -> All]
(* 7 solutions with up to 4 conditions each *)

The solutions here are the Solve[] version of the Reduce[] solutions that Frank Kampas shows.


Another way:

Eliminate[Append[sys, c2 c3 == c1 c4], {c4}]
Solve[%, {x1, x2, x3}]
(*
c3 x1 - c1 x2 == 0 && -c1 + x1 x3 == 0 && -c3 + x2 x3 == 0 && 
 c2 x3 - c1 x4 == 0 && -c2 + x1 x4 == 0 && -c2 c3 + c1 x2 x4 == 0

{{x1 -> c2/x4, x2 -> (c2 c3)/(c1 x4), x3 -> (c1 x4)/c2}}
*)
POSTED BY: Michael Rogers
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