1
$\begingroup$
Manipulate[ Plot[x^2 - 2 (m - 1) x + m (m - 3), {x, -30, 30}, PlotRange -> p], {m, -10, 10, 0.25, Appearance -> "Labeled"}, {p, -50, 1500, 50, Appearance -> "Labeled"}]

I have this and am trying to add a line on the output graph with the following slope and intersection

y=-13.3871 + 0.774194 x

I've tried to add a grid line of this line, but it will only work for vertical and horizontal lines it seems.

I'd appreciate any help. Thanks

$\endgroup$
2
  • $\begingroup$ Welcome to Mathematica SE. To get started:1) take the introductory tour now,2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge,3) remember to accept the answer, if any, that solves your problem, by clicking checkmark sign,4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – user49048
    Commented Mar 5, 2022 at 0:05
  • 1
    $\begingroup$ A question: if I try to execute the following I get a Plot. Can you please try it to see if this is what you want? Perhaps I misunderstood your question. The command is: Manipulate[ Plot[{x^2 - 2 (m - 1) x + m (m - 3), -13.3871 + 0.774194 x}, {x, -30, 30}, PlotRange -> p], {m, -10, 10, 0.25, Appearance -> "Labeled"}, {p, -50, 1500, 50, Appearance -> "Labeled"}] $\endgroup$
    – user49048
    Commented Mar 5, 2022 at 0:08

2 Answers 2

3
$\begingroup$

As an alternative the following produces the same output as the code by @cvgmt

Manipulate[  Plot[{x^2 - 2 (m - 1) x + m (m - 3), -13.3871 + 0.774194 x}, {x, -30,     30}, PlotRange -> p], {m, -10, 10, 0.25,    Appearance -> "Labeled"}, {p, -50, 1500, 50,    Appearance -> "Labeled"}]
$\endgroup$
2
$\begingroup$

Use Epilog to add a line InfiniteLine[{0, -13.3871}, {1, 0.774194}] with direction {1, 0.774194}.

Manipulate[
 Plot[x^2 - 2 (m - 1) x + m (m - 3), {x, -30, 30}, PlotRange -> p, 
  Epilog -> InfiniteLine[{0, -13.3871}, {1, 0.774194}]], {m, -10, 10, 
  0.25, Appearance -> "Labeled"}, {p, -50, 1500, 50, 
  Appearance -> "Labeled"}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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