1
$\begingroup$

Does anyone know how to make a plot display (permanently and/or as tooltips) both the labels and values of the intersection points?

$\endgroup$
2
  • $\begingroup$ If you could show your workings so far, we could take it from there. Additionally, depending on chosen implementation, I would recommend to look at Labeled[] and Drawing tools which are available by accessing Graphics>Drawing tools. $\endgroup$ Dec 13 '15 at 22:28
  • $\begingroup$ What do you mean by "Letters of the intersection points"? $\endgroup$
    – march
    Dec 13 '15 at 23:15
3
$\begingroup$
f[y_] := -10 y^2 + 4000 y;

Manipulate[
 Module[{pts, solQ},
  Column[{
    (pts = Cases[
        Simplify[
         {x, f[x]} /. Solve[f[x] == m*x + b,
           x, Reals]], _?(FreeQ[#, x] &)]) //
     N,
    solQ = Length[pts] > 0;
    Plot[{f[x],
      If[solQ, m*x + b, 0]},
     {x, 0, 400},
     PlotRange -> {{-10, 410}, {-10, 410000}},
     Epilog -> {Red, PointSize[Large],
       Tooltip[Point[#], #] & /@ pts,
       If[solQ, Text["A", pts[[1]], {1.5, -1.5}]],
       If[solQ, Text["B", pts[[-1]], {-1.5, -1.5}]]},
     ImageSize -> 360,
     PlotLegends -> {f[x], m x + b}]}]], {{m, 0, "Slope"}, -1000, 
  1000, 20,
  Appearance -> "Labeled"},
 {{b, 144000, "y Intercept"}, 0, 400000, 2000,
  Appearance -> "Labeled"}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Excellent answer, but I'd need a simpler solution. Thanks! $\endgroup$
    – puckie
    Dec 14 '15 at 22:39

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.