0
$\begingroup$

So, i want to express these:

$$\max(\cos(x)\cos(y)\cos(z)),\quad x+y+z=\pi,\quad x,y,z\in(0,\pi]$$

Attempt:

In[81]:= NMaximize[{Cos[x] Cos[y] Cos[z], 
  x + y + z == Pi && 0 < x <= \[Pi] && 0 < y <= \[Pi] && 
   0 < z <= \[Pi]}, {x, y, z}]

Out[81]= {0.125, {x -> 1.0472, y -> 1.0472, z -> 1.0472}}

But how so? I tried manually like this:

In[82]:= N[Cos[30 Degree] Cos[30 Degree] Cos[30 Degree]]

Out[82]= 0.649519

The above calculation implies there are numbers greater than the maximum value, i mean $0.649>0.125$. I think, i made a mistake to formulate the expression. Could you help me please? If the formulation is correct that would be greater or equal to Out[82]. Thanks in advance?

$\endgroup$
2
  • 3
    $\begingroup$ x = y = z = 30 Degree doesn't satisfy your constraint x + y + z = 180 Degree. I believe your code does produce the correct maximum, given your constraint. $\endgroup$ Commented Mar 16, 2021 at 23:09
  • 1
    $\begingroup$ Drawing a picture can help with confidence about an answer: ContourPlot[Cos[x] Cos[y] Cos[\[Pi] - x - y], {x, 0, \[Pi]}, {y, 0, \[Pi] - x}, Contours -> Range[-12, 12]/100., PlotPoints -> 100]. $\endgroup$
    – JimB
    Commented Mar 16, 2021 at 23:19

1 Answer 1

3
$\begingroup$

You can use Maximize or ArgMax or MaxValue to confirm your result.

Maximize[{Cos[x] Cos[y] Cos[z], 
  x + y + z == Pi && 0 < x <= π && 0 < y <= π && 
   0 < z <= π}, {x, y, z}]

{1/8, {x -> π/3, y -> π/3, z -> π/3}}

ArgMax[{Cos[x] Cos[y] Cos[z], 
  x + y + z == Pi && 0 < x <= π && 0 < y <= π && 
   0 < z <= π}, {x, y, z}]

{π/3, π/3, π/3}

MaxValue[{Cos[x] Cos[y] Cos[z], 
  x + y + z == Pi && 0 < x <= π && 0 < y <= π && 
   0 < z <= π}, {x, y, z}]

1/8

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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