Message Boards Message Boards

0
|
2883 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Solving system of equations works on V7 but not V12?

Posted 3 years ago

Hi guys, This question is related to solving a system of linear equations (the Specific Gravity of a mixture) In my old version of Mathematica7 when I run the following:

Solve[{m1 + m2 == m3, v1 + v2 == v3, m1/v1 == SG1, m2/v2 == SG2, 
  m3/v3 == SG3, m1/((m1 + m2)) == Cw, SG1 == 1.35, SG2 == 1, 
  Cw == 0.52}, SG3]
output[1]: {{SG3 -> 1.15582}}

However if I run the same code in Mathematica12 I get:

a blank output, aka no answer.

What should I be doing instead to get an output in Mathematica 12? Has "Solve" changed? what should I do differently? (SG1 = solids, SG2 = Liquid(Water), SG3 = mixture, Cw = percent of solids)

Thanks, James

Attachments:
POSTED BY: James Shaw
3 Replies

I suppose it is the same reason why this gives an empty answer:

Solve[{a + c == 0, a - b == 0}, a]

When you solve for a, you ask for a solution of the form {{a->something}}, but it can't. The following variant works, though, because it allows for a solution of the form {{a->something,c->something}}:

Solve[{a + c == 0, a - c == 0}]
POSTED BY: Gianluca Gorni

Try:

 $Version
  (* "12.3.0 for Microsoft Windows (64-bit) (May 10, 2021)"*)

Solve is symbolic solver need exact values:

 Solve[{m1 + m2 == m3, v1 + v2 == v3, m1/v1 == SG1, m2/v2 == SG2, 
   m3/v3 == SG3, m1/((m1 + m2)) == Cw, SG1 == 135/100, SG2 == 1, 
   Cw == 52/100}, SG3, MaxExtraConditions -> All]

 (*{{SG3 -> ConditionalExpression[675/584, 
     And[-13 + 25 Cw == 0, (-12) m1 + 13 m2 == 0, (-25)
          m1 + 13 m3 == 0, -27 + 20 SG1 == 0, -1 + SG2 == 0, (-20)
          m1 + 27 v1 == 0, (-12) m1 + 13 v2 == 0, (-584)
          m1 + 351 v3 == 0]]}}*)

With numeric values gives errors,but can solve:

   Solve[{m1 + m2 == m3, v1 + v2 == v3, m1/v1 == SG1, m2/v2 == SG2, 
     m3/v3 == SG3, m1/((m1 + m2)) == Cw, SG1 == 1.35, SG2 == 1, 
     Cw == 0.52}, SG3, MaxExtraConditions -> 8]
POSTED BY: Mariusz Iwaniuk
Posted 3 years ago

Hi Mariusz,

What you suggested seems to work. Do you have any comments on why the code I wrote wasn't working?

POSTED BY: James Shaw
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