2
$\begingroup$

I am trying to solve an equation with a constraint involving not-equal.

For example:

$2 x + 3 y = 5$ with the constraint $2 x + 4 ≠ 2$.

How should I approach this?

Edit 1

I tried the suggestions in the comments. I am actually trying to get Mathematica to return a numerical set of values for each variable (which doesnt seem to work via the suggested methods). Any suggestions on this?

Edit 2:

I should have clarified. What I would like Mathematica to do is to give a range of values for both variables $x$ and $y$.


Reduce[{2 x + 3 y == 5, 2 x + 4 != 2}, {y}, Reals]

gives

(x < -1 || x > -1) && y == 1/3 (5 - 2 x)

So there is x-range, but how to get y-range?

$\endgroup$
9
  • 1
    $\begingroup$ != means not equal. $\endgroup$ – wuyudi Oct 29 '20 at 12:15
  • 2
    $\begingroup$ You would write: Solve[{2 x + 3 y == 5, 2 x + 4 != 2}, x] $\endgroup$ – Daniel Huber Oct 29 '20 at 12:45
  • 2
    $\begingroup$ Reduce[{2 x + 3 y == 5, 2 x + 4 != 2}, x] would be better. $\endgroup$ – Sjoerd Smit Oct 29 '20 at 12:47
  • 2
    $\begingroup$ What numerical expression would you find acceptable? $\endgroup$ – Michael E2 Oct 29 '20 at 18:26
  • 1
    $\begingroup$ I was wondering if Mathematica could give something like x =/= -1 and y =/= 7/3 or something along the lines of that. $\endgroup$ – Adrian Lee Oct 30 '20 at 14:02
2
$\begingroup$

How about

Reduce[{2 x + 3 y == 5, 2 x + 4 != 2}, {x, y}, Reals]
(*(x < -1 || x > -1) && y == 1/3 (5 - 2 x)*)

?

$\endgroup$
1
  • $\begingroup$ Thanks. I tried that. It looks good - do you think Mathematica could give an explicit set of values that y can take? Or can it only find y in terms of x? Thanks! $\endgroup$ – Adrian Lee Oct 30 '20 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.