# How to mark global minimum and maximum with manipulate

How do I get a graph to mark (in red, say) the global minimum and maximum? So then as I scroll through the values of $d$, it should move in real time. I hope this is possible!

f[x_, d_] := ArcSin[(x^2 + 24^2 - d^2)/(2*24*x)]


The extrema can be extract from the Line[___] parts of the plot:

Manipulate[With[{plot = Plot[f[x, d], {x, 6.5, 15}, PlotRange -> {-Pi/2, Pi/2}]},
With[{data = Join @@ Cases[plot, Line[___], {0, ∞}][[All, 1]]},
Show[plot,
Graphics[{Red, PointSize[1/75], Point /@ Extract[data, Position[
data[[All, 2]], Alternatives @@ MinMax[data[[All, 2]]], {1}]]}]
]
]], {d, 17.5, 30.5}]


Here is a solution, with some slight modifications in the ranges to see what's happening :

f[x_, d_] := ArcSin[(x^2 + 24^2 - d^2)/(2*24*x)]
Manipulate[
max=FindMaximum[{f[x,d],6.5<= x <= 15},{x,10.}];
Plot[f[x, d], {x, 6.5, 15},PlotRange -> Automatic(*{-Pi/2, Pi/2}*),
Epilog->{Red,PointSize[0.05],Point[{max[[2,1,2]],max[[1]]}]} ],
{{d,21.55}, 21.55, 21.83}
]


One can see that the maximum suddenly jumps from the left side to the right side as d increases.