Does anyone know how to make a plot display (permanently and/or as tooltips) both the labels and values of the intersection points?
1 Answer
$\begingroup$
$\endgroup$
1
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"}]
-
$\begingroup$ Excellent answer, but I'd need a simpler solution. Thanks! $\endgroup$– puckieDec 14, 2015 at 22:39
Labeled[]
and Drawing tools which are available by accessing Graphics>Drawing tools. $\endgroup$