0
$\begingroup$

I try to maximise a following function:

 x[t_] := 
 1/4 (-1 + a) + a/4 + 1/2 Sqrt[a - a^2] Cos[d] - 
  1/4 (1 - a) Cos[d + 2*t] + 1/4 a Cos[d - 2*t] + 
  1/2 Sqrt[a - a^2] Cos[2*t]

with respect to a and d. What is more, $t \in (0,\frac{\pi}{4})$. From NMaximize I know what the range of a and d should be (see figures, where, however, $t \in (0,\frac{\pi}{2})$),

Numerical maximisation with respect to a

Numerical maximisation with respect to d

but I am looking for the analytical formula.

I have written something like this

Maximize[{x[t], 0 < t < Pi/4, 4/5 < a < 1, 0 < d < Pi/2}, {a, d}]

(I have hoped that limiting the possible values of a and d will help Mathematica), but the output is the same as the input.

Does it mean that the Mathematica is not able to give the analytical form of the maximisation?

$\endgroup$
  • 2
    $\begingroup$ "analytical formula" - considering the moderate complexity of your (transcendental!) function, expecting an analytic answer seems a little unreasonable. $\endgroup$ – J. M.'s technical difficulties May 16 at 13:00
  • $\begingroup$ Can one say something more rather than it is unreasonable? I mean if one can exactly state, that, according to some theorems, such an analytical solution does not exist? $\endgroup$ – Agnieszka May 16 at 13:11
  • 1
    $\begingroup$ If you recall that you essentially want to find the zero of a derivative, and then recall that there is usually no systematic method for finding roots of a transcendental equation... $\endgroup$ – J. M.'s technical difficulties May 16 at 13:15
  • $\begingroup$ Hm, ok, this seems reasonable. Oh, damn it :(. $\endgroup$ – Agnieszka May 16 at 13:17
  • $\begingroup$ Note that I didn't say there surely isn't a closed-form solution. Just that it's unlikely. $\endgroup$ – J. M.'s technical difficulties May 16 at 13:32
2
$\begingroup$

A non-rigorous approach.

Clear["Global`*"]

x[t_] := 1/4 (-1 + a) + a/4 + 1/2 Sqrt[a - a^2] Cos[d] - 
  1/4 (1 - a) Cos[d + 2*t] + 1/4 a Cos[d - 2*t] + 1/2 Sqrt[a - a^2] Cos[2*t]

{max, arg} =
 (NMaximize[{x[t], 0 < t < Pi/4, 4/5 < a < 1, 0 < d < Pi/2},
      {a, d, t}, WorkingPrecision -> 20] // N // Chop) /.
  v_?NumericQ :> RootApproximant[v]

(* {1/Sqrt[2], {a -> 1/4 (2 + Sqrt[2]), d -> 0, t -> 0}} *)

The derivatives are all identically zero at arg

Grad[x[t], {t, a, d}] /. arg // Simplify

(* {0, 0, 0} *)

nmax[t_?(0 <= # <= Pi/4 &)] := Module[
  {tt = SetPrecision[t, 20]},
  NMaxValue[{x[tt], 4/5 < a < 1, 0 < d < Pi/2},
   {a, d}, WorkingPrecision -> 15]]

data = Table[{t, nmax[t]}, {t, 0, Pi/4, Pi/100}] // N;

ListLinePlot[data, Frame -> True, FrameLabel -> {"t", "nmax"}]

enter image description here

EDIT: Maximize finds the global maximum if the constraints are modified slightly.

{max, arg} = 
 Maximize[{x[t], 0 <= t < Pi/4, 0 < a < 1, 0 <= d < Pi/2}, {t, a, d}]

(* {1/Sqrt[2], {t -> 0, a -> 1/2 (1 + 1/Sqrt[2]), d -> 0}} *)

Setting d == 0, then the maximum for this special case as a function of t is

{maxd0, argd0} = Maximize[
   {x[t] /. d -> 0 // Simplify, 0 <= t < Pi/4, 0 < a < 1}, a] // 
  Simplify[#, 0 <= t < Pi/4] &

(* {Cos[t]^2/Sqrt[2], {a -> 1/4 (2 + Sqrt[2])}} *)

Plot[maxd0, {t, 0, Pi/4},
 PlotLabel -> StringForm["d = 0 && ``", Equal @@ argd0[[1]]],
 AxesLabel -> (Style[#, 12, Bold] & /@ {"t", "maxd0"})]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanking for using RootApproximant, as I didn't know it yet, but these a and d do not maximise the function for all t: 0<t<Pi/4. E.g. a choice a -> 9/10, d -> 9/10*Pi/2 get greater max from ca. 0.5... $\endgroup$ – Agnieszka May 16 at 14:17
  • $\begingroup$ 0.529791 < 1/Sqrt[2] $\endgroup$ – Bob Hanlon May 16 at 14:26
  • $\begingroup$ Oh, sorry, your maximisation is only for t=0, and there it is true. The problem is that I want to maximise the time function x[t] with respect to a and d, but not t. $\endgroup$ – Agnieszka May 16 at 14:40
  • $\begingroup$ Hm, ok, bit this is not an analytical solution. I do not have problems to get the numerical one. $\endgroup$ – Agnieszka May 16 at 15:09

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.