4
$\begingroup$

In TI-Nspire CX CAS, writing:

exp▶list(fMax(sin(x),x,0,10),x)

I get:

{((π)/(2)),((5*π)/(2))}

while in Wolfram Mathematica, writing:

Maximize[{Sin[x], 0 <= x <= 10}, x]

I get:

{1, {x -> π/2}}

Is there a way to get the result above?

$\endgroup$
4
$\begingroup$
Reduce[{Sin'[x] == 0, Sin''[x] <= 0, 0 <= x <= 10}, x, Reals]

x == π/2 || x == (5 π)/2

List @@ %

{x == π/2, x == (5 π)/2}

Alternatively,

Solve[{Sin'[x] == 0, Sin''[x] <= 0, 0 <= x <= 10}, x, Reals]

{{x -> π/2}, {x -> (5 π)/2}}

 x /. %

{π/2, (5 π)/2}

or

x /. {ToRules[Reduce[{Sin'[x] == 0, Sin''[x] <= 0, 0 <= x <= 10}, x, Reals]]}

{π/2, (5 π)/2}

$\endgroup$
6
$\begingroup$

I would use MaxValue in combination with Solve:

maxima[{expr_, cond_}, v_] := With[{m = MaxValue[{expr, cond}, v]},
    DeleteDuplicates @ Solve[expr == m && cond, v]
]

For your example:

maxima[{Sin[x], 0<=x<=10}, x]

{{x -> π/2}, {x -> (5 π)/2}}

Contrast this with the approach in kglr's answer that only looks at critical points:

maxima[{Sin[x], -1 <= x <= 1}, x]

Reduce[{Sin'[x]==0,Sin''[x]<=0,-1<=x<=1},x,Reals]

{{x -> 1}}

False

$\endgroup$

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.