0
$\begingroup$

I must calculate the critical point on the function

f[x_] := (x^2 - Abs[x - 10])/(x - 5)

After plotting, I looked for the minimum where it looked to be (around 10)

FindMinimum[f[x], {x, 6}]

Got output:

{19.9443, {x -> 9.47214}}

and then tried to rationalize x:

Rationalize[9.472135911356355`]

How can I get an exact value?

$\endgroup$
  • $\begingroup$ The answer by @MariusLadegardMeyer is, in my opinion, the "right" way to go about this. But one can also use the approach in this post, with RootApproximant replacing Rationalize. In[269]:= RootApproximant[NArgMin[{f[x], x >= 5}, x]] Out[269]= 5 + 2 Sqrt[5] $\endgroup$ – Daniel Lichtblau Jun 20 '18 at 14:06
6
$\begingroup$

Use Minimize with a condition that avoids the divergence to $-\infty$:

Minimize[{f[x], x > 5}, x]

{(-5 + 2 Sqrt[5] + (5 + 2 Sqrt[5])^2)/( 2 Sqrt[5]), {x -> 5 + 2 Sqrt[5]}}

It's the same minimum:

N[5 + 2 Sqrt[5]]

9.47214

$\endgroup$
  • $\begingroup$ Thank you Majin Boo, you're best! $\endgroup$ – Dovendyr Jun 20 '18 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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