1
$\begingroup$
Maximize[{ω, -(π/6) + (
     k π)/ω <= π, -(π/
      6) + ((k + 1) π)/ω >= (4 π)/3, ω > 0, 
   k ∈ Integers}, {k, ω}] // FullSimplify
In[446]:= 
Maximize[{ω, -(π/6) + (
     k π)/ω <= π, -(π/
      6) + ((k + 1) π)/ω >= (4 π)/3, ω > 0, 
   k ∈ Integers}, {k, ω}] // FullSimplify

During evaluation of In[446]:= Maximize::mixdom: Exact optimization with mixed real and integer variables is not yet implemented.

Out[446]= Maximize[{ω, (6 k)/ω <= 7, (
   2 (1 + k))/ω >= 3, ω > 0, 
  k ∈ Integers}, {k, ω}]
```
$\endgroup$

2 Answers 2

3
$\begingroup$

Take the integer restriction off k and you get a good hint.

Maximize[{\[Omega], -(Pi/6) + (k*Pi)/\[Omega] <= Pi, -(Pi/6) + ((k + 1)*Pi)/\[Omega] >= (4*Pi)/3, \[Omega] > 0}, {\[Omega]}]

(*{Piecewise[{{(2*(k + 1))/3, Inequality[-1, Less, k, LessEqual, 7/2]}},-Infinity], {\[Omega] -> Piecewise[{{(2*(k + 1))/3, Inequality[-1, Less, k, LessEqual, 
    7/2]}}, Indeterminate]}}*)

From this you know that -1 < k <= 7/2

So make a table

Table[{k, Maximize[{\[Omega], -(\[Pi]/6) + (k \[Pi])/\[Omega] <= \[Pi], -(\[Pi]/6) + ((k + 1) \[Pi])/\[Omega] >= (4 \[Pi])/3, \[Omega] > 0},{\[Omega]}]}, {k, 0, 5}]

{{0, {2/3, {\[Omega] -> 2/3}}}, {1, {4/3, {\[Omega] -> 4/3}}}, {2, {2,{\[Omega] -> 2}}}, {3, {8/3, {\[Omega] -> 8/3}}}, {4, {-\[Infinity],{\[Omega] -> Indeterminate}}}, {5, {-\[Infinity], {\[Omega] -> Indeterminate}}}}

And now we know the maximum occurs at k = 3 if k must be an integer. Otherwise it occurs at k = 7/2.

$\endgroup$
3
$\begingroup$

modified

NMaximize

NMaximize[{\[Omega], -(\[Pi]/6) + (k \[Pi])/\[Omega] <= \[Pi], -(\[Pi]/6) + ((k + 1) \[Pi])/\[Omega] >= (4 \[Pi])/3, \[Omega] > 0, k \[Element] Integers}, {k, \[Omega]}]
(*{2., {k -> 2, \[Omega] -> 2.}}*)

gives wrong result!

Reduce helps to find the maximum:

cond=Reduce[{-(\[Pi]/6) + (k \[Pi])/\[Omega] <= \[Pi], -(\[Pi]/6) + ((k + 1) \[Pi])/\[Omega] >= (4 \[Pi])/3,Element[k, PositiveIntegers], \[Omega] > 0}, \[Omega]]
(*(k == 1 && 6/7 <= \[Omega] <= 4/3) || (k == 2 && 12/7 <= \[Omega] <= 2) || (k == 3 && 18/7 <= \[Omega] <= 8/3)*)

Maximize[{\[Omega], cond[[All, 2]]}, \[Omega]]
(*{8/3, {\[Omega] -> 8/3}}*)
$\endgroup$
2
  • $\begingroup$ This maximum value has an accurate value of 8/3 $\endgroup$
    – csn899
    Jun 8 at 7:06
  • $\begingroup$ @csn899 Don' tknow why NMaximizegives wrong result. See my modified answer. $\endgroup$ Jun 8 at 7:49

Your Answer

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

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