# How to find the minimum of this function?

-((0.6666666666666666 (r Sqrt[(
63.49604207872798 - 31.74802103936399 r +
1.1 (-2 + r)^(2/3) r)/(
63.496042078727974 - 31.748021039363987 r +
1. (-2 + r)^(2/3) r)] (-9. + 2 r - (
0.02309855258140601 r^3)/(-2 + r)^(1/3)) -
2 (1 - 0.034647828872109016 (-2 + r)^(2/3) - 2/r) (-2.25 r +
r^3 Sqrt[(
63.49604207872798 - 31.74802103936399 r +
1.1 (-2 + r)^(2/3) r)/(
63.496042078727974 - 31.748021039363987 r +
1. (-2 + r)^(2/3)
r)] + (r^3 (2.2737367544323206*^-13 (-2 + r)^(1/3) +
r (-6.349604207872807 -
1.1368683772161603*^-13 (-2 + r)^(1/3) +
r (5.291336839894001 + (-1.0582673679787984 -
5.551115123125783*^-17 (-2 + r)^(
2/3)) r))))/((-2 + r)^(
1/3) (63.496042078727974 + (-31.748021039363987 +
1. (-2 + r)^(2/3)) r)^2 Sqrt[(
63.49604207872798 - 31.74802103936399 r +
1.1 (-2 + r)^(2/3) r)/(
63.496042078727974 - 31.748021039363987 r +
1. (-2 + r)^(2/3) r)])) +
2.25 r^2 (-(0.02309855258140601/(-2 + r)^(1/3)) + 2/

r^2 + (-4.547473508864641*^-13 (-2 + r)^(1/3) +
r (12.699208415745616 +
2.2737367544323206*^-13 (-2 + r)^(1/3) +
r (-10.582673679788002 + (2.116534735957597 +
1.1102230246251565*^-16 (-2 + r)^(
2/3)) r)))/((-2 + r)^(1/3)
r (63.496042078727974 + (-31.748021039363987 +
1. (-2 + r)^(2/3)) r)^2 Sqrt[(
63.49604207872798 - 31.74802103936399 r +
1.1 (-2 + r)^(2/3) r)/(
63.496042078727974 - 31.748021039363987 r +
1. (-2 + r)^(2/3)
r)]))))/(-2. + ((0.13859131548843606 +
2. (-2 + r)^(1/3) - 0.09239421032562405 r) r)/(-2 + r)^(
1/3)))


Is there a way to find the value of $r$ where the function above is at its minimum?

I am trying to find the minimum value of the function?

How to use Mathematica to find the position of the red circle on the graph?

Thank you.

• What have you tried? I assume you did search the documentation and found these functions: reference.wolfram.com/language/guide/Optimization.html Feb 10, 2017 at 10:33
• @Szabolcs, I tried NSolve and NMinimize but they gave wrong result.
– gbd
Feb 10, 2017 at 10:35
• FindMinimum[fn, {r, 2.1}] ? Feb 10, 2017 at 10:38
• Explain in the question what you tried please. Show specific code. If you believe that the result is wrong, show why. Also, please use relevant tags next time. The question does not seem to be about either plotting or differential equations. Feb 10, 2017 at 10:38
• @gbd Your function is undefined at some points r<=2 (try evalating fn[2]). How do you want to treat this region? Feb 10, 2017 at 12:13

fis your function. Then:

tab = Table[{r, f}, {r, 2.1, 3, 0.0001}];
min = MinimalBy[tab, Last]


{{2.27, 2.45707}}

ListLinePlot[tab, DataRange -> {2.1, 3}, Epilog -> {Red, PointSize@Medium, Point@min},
PlotTheme -> "Detailed"]


Check with FindMinimum:

FindMinimum[f, {r, 2.1}]


{2.45707, {r -> 2.26997}}

I find that using FunctionDomain can be helpful in cases like this.

limits = FunctionDomain[f[r], r]
(* 2. < r < 2.0001 || 2.0001 < r < 2.00025 ||
2.00033 < r < 100.46 || 100.46 < r < 154.045 || r > 177.877 *)


Now we can use the third element of limits as a constraint in NMinimize.

NMinimize[{f[r], limits[[3]]}, r]
(* {2.45707, {r -> 2.26997}} *)


Below the results are plotted

Show[
Plot[f[r], {r, 2, 5}, PlotRange -> {{0, 6}, {0, 20}},
PlotStyle -> Black],
ListPlot[{{2.26997, f[2.26997]}},
PlotStyle -> {PointSize[Large], Red}]
]
`