5
$\begingroup$
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}]

This is the graph

$\endgroup$
2

3 Answers 3

4
$\begingroup$
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]}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks it helped alot $\endgroup$
    – Student
    Commented Dec 24, 2020 at 11:45
4
$\begingroup$
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]]] 

enter image description here

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

enter image description here

$\endgroup$
1
$\begingroup$

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
 ]

enter image description here

Hope this helps

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

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