1
$\begingroup$

This question already has an answer here:

I want to find the minimum of the function $\sin^6 x + \cos^6 x$. I tried

Minimize[{Sin[x]^6 + Cos[x]^6, 0 <= x <= 2 Pi}, x]

I got

{Cos[2 ArcTan[1 - Sqrt[2]]]^6 + Sin[2 ArcTan[1 - Sqrt[2]]]^6, {x -> -2 ArcTan[1 - Sqrt[2]]}} NMinimize[{Sin[x]^6 + Cos[x]^6, 0 <= x <= 2 Pi}, x]

And I tried

NMinimize[{Sin[x]^6 + Cos[x]^6, 0 <= x <= 2 Pi}, x]

I got

{0.25, {x -> 3.92699}}

How can I use the command minnimize?

$\endgroup$

marked as duplicate by Michael E2, Yves Klett, Öskå, b.gates.you.know.what, Dr. belisarius Dec 18 '14 at 17:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4
$\begingroup$
$Version

"10.0 for Mac OS X x86 (64-bit) (December 4, 2014)"

f[x_] = Sin[x]^6 + Cos[x]^6;

sol = FullSimplify[Minimize[
   {f[x], 0 <= x <= 2 Pi}, x]]

{1/4, {x -> (7*Pi)/4}}

However, this is just one of the four minima. To find all four:

pts = {x, f[x]} /. Solve[
    {f'[x] == 0, f''[x] > 0, 0 <= x <= 2 Pi}, x] //
  FullSimplify

{{Pi/4, 1/4}, {(7*Pi)/4, 1/4}, {(5*Pi)/4, 1/4}, {(3*Pi)/4, 1/4}}

Plot[f[x], {x, 0, 2 Pi},
 Epilog -> {Red, AbsolutePointSize[6],
   Point[pts]}]

enter image description here

$\endgroup$
3
$\begingroup$

The problem you face here is that your function has several minima in the range you specified:

Mathematica graphics

If you want them all, you can use Reduce, but for this, you need the approach you learned in school: calculate the derivative of your function and calculate where it is zero. Then use the second derivative and check whether it is >0 to indicate that you want a minimum. And now the code is straight forward:

f = Sin[x]^6 + Cos[x]^6;
df = D[Sin[x]^6 + Cos[x]^6, x];
ddf = D[df, x];

sol = Reduce[df == 0 && ddf > 0 && 0 <= x <= 2 Pi, x]

Mathematica graphics

To display the solutions, you can convert them to points and show everything in a single graphics:

points = Point[{x, f} /. #] & /@ Flatten[{ToRules[sol]}];
Show[
 Plot[f, {x, 0, 2 Pi}],
 Graphics[{Red, PointSize[0.02], points}]
 ]

Mathematica graphics

$\endgroup$
1
$\begingroup$

Minimize returns a symbolic result as it is designed to do. It is working correctly.

To force the return of a numeric result you must "encourage" Minimize to do so. This makes it call NMinimize instead. A simply way is to multiply any portion by 1. to make it floating point. The decimal point is important.

Minimize[{1.Sin[x]^6 + Cos[x]^6, 0 <= x <= 2 \[Pi]}, x]
$\endgroup$

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