0
$\begingroup$

I have this two equations, and I want to solve them in a graphical way.

enter image description here

So, -I'm thinking- how can I plot them at the same time?

$\endgroup$
6
  • 2
    $\begingroup$ Read the help articles on ContourPlot and Solve. They will show you the way. $\endgroup$ Commented May 20, 2019 at 0:08
  • 2
    $\begingroup$ Plot[{3-2x, (4-x)/3},{x,0,1}]? $\endgroup$ Commented May 20, 2019 at 0:09
  • $\begingroup$ Thanks. If I have equations with more than one variable, how can I set the range for each variable. I mean in this case you propose for x range ,{x,0,1}; what happen if I have x, y, z, etc? $\endgroup$ Commented May 20, 2019 at 1:58
  • 1
    $\begingroup$ The option PlotRange can be used to set the range for both variables. $\endgroup$
    – m_goldberg
    Commented May 20, 2019 at 2:42
  • $\begingroup$ does ContourPlot[{2 x + y - 3 == 0, x + 3 y == 4}, {x, -1, 3}, {y, -1, 3}, FrameLabel -> (Style[#, 12, Bold] & /@ {x, y}), MeshFunctions -> {Boole[2 # + #2 == 3 && (# + 3 #2 == 4)] &}, Mesh -> {{1}}, MeshStyle -> {Directive[Red, PointSize[Large]]}, PlotLegends -> Placed["Expressions", {.8, .9}]] work in your version? $\endgroup$
    – kglr
    Commented May 20, 2019 at 5:14

1 Answer 1

2
$\begingroup$
pt = {x, y} /. Solve[{2 x + y - 3 == 0, x + 3 y == 4}, {x, y}][[1]]

(* {1, 1} *)

Legended[
 ContourPlot[
  {2 x + y - 3 == 0, x + 3 y == 4},
  {x, -1, 3}, {y, -1, 3},
  FrameLabel -> (Style[#, 12, Bold] & /@ {x, y}),
  Epilog -> {Red, AbsolutePointSize[4], Point[pt]}],
 Placed[
  LineLegend[
   {ColorData[97][1], ColorData[97][2]},
   {2 x + y - 3 == 0, x + 3 y == 4}], {.7, .7}]]

enter image description here

$\endgroup$

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