Message Boards Message Boards

0
|
7814 Views
|
8 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?]  One simple equation gets answer, similar one does not?

Posted 6 years ago

In Mathematica 11.2, when I try

Solve[{x + y == 12, y == 2 x}, {x}]

I get

{{x -> 4}}

Looks good. But, if I do

Solve[{x + y == 25, y == 4 x}, {x}]

I get

{{ }}

?

8 Replies

Thanks, Michael.

That works in mathematica online!

In[1]:=Solve[{x+y==25,y==4x},{x},{y}]
Out[1]={{x->5}}

Curiously, when I do this in 11.2, I get:

Solve::ivar: 2 x is not a valid variable.
Solve[{3 x == 25, 2 x == 4 x}, {x}, {2 x}]

Weird.

POSTED BY: Michael Rogers

You can use the old syntax, specifying a list of variables to eliminate in the third argument:

Solve[{x + y == 25, y == 4 x}, {x}, {y}]
(*  {{x -> 5}}  *)
POSTED BY: Michael Rogers

Is there a reason you don’t use Solve to solve your two equations with two unknowns (x and y)?

If you change {x} to {x,y} you will always get the complete answer for either set of equations.

POSTED BY: Neil Singer

Thanks Valeriu and Tanel. It's cool that the Reduce function works, sort of (I would expect given y==2, the result should be in terms of y==2). The biggest question I don't understand is why Solve for the first formula works, but not for the second, in all cases. I can repeat this in both online and the desktop version.

Only Reduce is giving values

In[7]:= Reduce[{x + y == 25, y == 4 x}, x]

Out[7]= y == 20 && x == 5

and

In[8]:= Reduce[{x + y == 12, y == 2 x}, {x}]

Out[8]= y == 8 && x == 4
POSTED BY: Tanel Telliskivi

I get for both of them:

In[1]:= Solve[{x + y == 12, y == 2 x}, {x}]
Out[1]= {}

In[2]:= Solve[{x + y == 25, y == 4 x}, {x}]
Out[2]= {}

As you try to solve systems with respect to only one variable, the results are correct.

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