2
$\begingroup$

I have a variable

x = l*Cos[t]*Cos[a] - Sin[t]*Sin[a]

and I want to find the maximum value of x with respect to a, as well as access the roots. I have tried MaxValue[x, a] but but just get

MaxValue[l Cos[a] Cos[t]-Sin[a] Sin[t],a]

So I did b = D[x, a] and was returned

-l Cos[t] Sin[a]-Cos[a] Sin[t]

I then did sx=Solve[b ==0, a] and was returned result of calculation

so what I would like to do next is something like

mx =x/. a-> sx[[1]]

but I am not sure how to how to handle the 2 PI ambiguity in the roots. Note that I want to extract the ambiguous roots even if it is possible to make MaxValue work. I just want the roots with c_1 = 0.

$\endgroup$
3
  • $\begingroup$ can you give more info like Domains or helping info about your problem $\endgroup$
    – Alrubaie
    Commented May 31, 2021 at 2:02
  • $\begingroup$ it shows that C1 is complex, what about domain of other values !? any extra info!? $\endgroup$
    – Alrubaie
    Commented May 31, 2021 at 2:14
  • $\begingroup$ c_1 is in Z, and in this case, Z is just the integers, i.e. not complex $\endgroup$
    – Obromios
    Commented May 31, 2021 at 9:41

1 Answer 1

2
$\begingroup$

Try Weierstrass-Subsitution: a->2 ArcTan[u] && u->Tan[a/2] which restricts a to the range -Pi<a<Pi and transforms the equation to a rational form.

x = l*Cos[t]*Cos[a] - Sin[t]*Sin[a]
xu = x /. a -> 2 ArcTan[u] // TrigExpand
(*(l Cos[t])/(1 + u^2) - (l u^2 Cos[t])/(1 + u^2) - (2 u Sin[t])/(1 + u^2)*) 

Now MaxValue evaluates maximum of x

max=MaxValue[xu, u] /. u -> Tan[a/2]
(*-Sqrt[l^2 Cos[t]^2 + Sin[t]^2]*)

ArgMax evaluates for which argument u the maximum is found

maxu = ArgMax[xu, u]
(*-(Sin[t]/(l Cos[t] + Sqrt[l^2 Cos[t]^2 + Sin[t]^2])) ...*)

  

All valid solutions a follow to a==2 ArcTan[maxu]+2 Pi Integer

$\endgroup$
3
  • $\begingroup$ I like this, it is elegant. However, as mentioned in the question, I also want to know the value of the roots, i.e of a. How do I do this? $\endgroup$
    – Obromios
    Commented May 31, 2021 at 9:42
  • $\begingroup$ Now my answer includes the value of the roots... $\endgroup$ Commented May 31, 2021 at 10:15
  • $\begingroup$ Thank you, I have upvoted and accepted your answer. If you think the question may be of use to others, then please upvote it. I suggest we delete our comments as all the information needed is now in the answer. $\endgroup$
    – Obromios
    Commented May 31, 2021 at 21:59

Your Answer

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

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