# How I can indicate the maximum point on a curve [closed]

y = r^2 (0.5) - r^3


I am trying to get maximum point on this graph from range 0 to 0.5. Can some one help??

Plot[y, {r, 0, 0.5}]


y = r^2 (0.5) - r^3;
max = NMaximize[{y, 0 < r < .5}, r]
pt = {r /. Last@max, First@max}
Plot[y, {r, 0, 0.5}, Epilog -> {PointSize[Large], Red, Point[pt]}]


• Thanks it helped alot Commented Dec 24, 2020 at 11:45
ClearAll[f]
f[r_] := r^2 (0.5) - r^3


An alternative approach to mark the interior local maxima of a differentiable function f using MeshFunctions + Mesh + MeshStyle:

Plot[f[r], {r, 0, 0.5},
MeshFunctions -> {If[f''[#] <= 0, f'[#], 1] &},
Mesh -> {{0}},
MeshStyle -> Directive[Red, PointSize[Large]]]


Normal[%] /. p_Point :> {p, Text["maximum", p[[1]], {-1, -1}]}


With Callout.

y[x_] := x^2 (0.5) - x^3
max = Maximize[{y[r], 0 < r < .5}, r];
pt = {r /. Last@max, First@max};


Then

Show[
Plot[y[r], {r, 0, .5}]
, ListPlot[{Callout[pt, "Maximum"]}, PlotStyle -> Red]
, PlotRange -> All
]


Hope this helps

• Or of course set the derivative to $0$, and solve for $x$. Commented Dec 24, 2020 at 19:53