1

I'm trying to find the maximum value of

d[x_]:=4-(1/5)x^2-3*Cos[Pi*x/6]

For -5 < x < 5. Aside from x=0 which is a local minimum, when I use Solve, I can only get the numerical values of x, or an answer with a bunch of #'s that I don't understand, like so:

In[61]:= Solve[d'[x] == 0 && -5 <= x <= 5]

Out[61]= {{x -> 0}, {x -> Root[{5 \[Pi] Sin[(\[Pi] #1)/6] - 
   4 #1 &, -3.6804064036641044765}]}, {x -> Root[{5 \[Pi] Sin[(\[Pi] #1)/6] - 4 #1 &, 3.6804064036641044765}]}}

Should I just be trying to use different syntax? Instead, which one?

Ashley
  • 31
  • 1
  • 1
    You can use N to get rid of those funny looking characters. SetSystemOptions[ "TypesetOptions" -> "NumericalApproximationForms" -> False]; Solve[d'[x] == 0 && -5 <= x <= 5, x] // N gives {{x -> 0.}, {x -> -3.68041}, {x -> 3.68041}} Mathematica can not find exact answer so used Root object. – Nasser Aug 04 '19 at 11:41
  • 3
    Mathematically is impossible to obtain a symbolic(analytic) solution for transcendental equation.To find maximum value try:NMaximize[{4 - (1/5)*x^2 - 3*Cos[Pi*x/6], -5 <= x <= 5}, x] – Mariusz Iwaniuk Aug 04 '19 at 11:42
  • 1
    For a maximum you also want to include the requirement that the second derivative is negative, i.e., d''[x] < 0. That will eliminate the minimum at x == 0 – Bob Hanlon Aug 04 '19 at 17:40

1 Answers1

3
Solve[{d'[x] == 0, -5 < x < 5}, x, Reals] // N
(*{{x -> 0.}, {x -> -3.68041}, {x -> 3.68041}}*)

gives what you're looking for (without bunch of # )

Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55