5
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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Student
  • 53
  • 2

3 Answers3

4
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

cvgmt
  • 72,231
  • 4
  • 75
  • 133
4
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

kglr
  • 394,356
  • 18
  • 477
  • 896
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
 ]

enter image description here

Hope this helps

Edmund
  • 42,267
  • 3
  • 51
  • 143