1
$\begingroup$

I am trying to find the greatest value of the function $\sin^{2024}x + \cos^{2025}x$. I tried

Maximize[Sin[x]^2024 + Cos[x]^2025, x] NMaximize[Sin[x]^2024 + Cos[x]^2025, x] 

For a long time, I have not yet the result. How can I get the result?

$\endgroup$

3 Answers 3

1
$\begingroup$

You can put $t = \sin x$, $-1 \leqslant t \leqslant 1$. Then $\cos x = \sqrt{1-t^2}$ or $\cos x = -\sqrt{1-t^2}$

NMaximize[{t^2024 + Sqrt[1 - t^2]^2025, -1 <= t <= 1}, t] 

{1., {t -> 7.707*10^-321}}

NMaximize[{t^2024 - Sqrt[1 - t^2]^2025, -1 <= t <= 1}, t] 

{1., {t -> -1.}}

$\endgroup$
2
  • $\begingroup$ So your fist answer is $t=0$ which corresponds to $x=0$ and your second answer is $t=-1$ which corresponds to $x=-\pi/2$. I think there are an infinite number of values of $x$ that result in the maximum value of 1. A plot of the function is handy. $\endgroup$ Commented Dec 25, 2024 at 3:57
  • $\begingroup$ This is a mathematical not numerical problem. I do not understand why this solution is accepted. Numerics can only give hints, not a definite answer. $\endgroup$ Commented Dec 25, 2024 at 20:46
5
$\begingroup$

The standard Calc I way, with exact answers:

cps = Solve[#[[1]] == 0, x, Reals, Method -> Reduce] & /@ FactorList@D[Sin[x]^2024 + Cos[x]^2025, x]; (* < 1 sec. *) vals = Sin[x]^2024 + Cos[x]^2025 /. Join @@ cps; vals /. ConditionalExpression[v_, c_] :> (* C[1] in Z *) Quiet@Simplify[v, c, TimeConstraint -> 0.1] // MinMax (* < 1 sec. *) (* {-1, 1} *) 
$\endgroup$
4
$\begingroup$

Math ans.: In magnitude $\sin ^{2024}(x)+\cos ^{2025}(x)$ is less than or equal to $\sin ^{2} x+\cos ^{2}x = 1$. And it's easy to see that is attained when $\cos x = \pm 1$, at which points the function value is also $\pm1$ respectively. (The max. is also attained when $\sin x = \pm 1$, but the max. value is still the same, obviously.)

$\endgroup$
2
  • $\begingroup$ Thank you for your answer. I also know this method, but I want to solve by Mathematica. $\endgroup$ Commented Dec 25, 2024 at 5:30
  • $\begingroup$ @JohnPaulPeter I know, but you accepted an answer that used math to simplify the problem and used Mma to finish the job. Just how much math can one use? One could finish the job I set out with Solve[Sin[x]^2024 + Cos[x]^2025 == 1, x, Reals] and Solve[Sin[x]^2024 + Cos[x]^2025 == -1, x, Reals, Method -> Reduce]. $\endgroup$ Commented Dec 25, 2024 at 6:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.