5
$\begingroup$

I am trying to use 'Solve' function to solve two trigonometric equations with two variables a1 and a2 (with range 0,2Pi). I wrote the code in the following:

  Vets={Cos[2a1](I+Cos[2a2])+Sin[2a1]Sin[2a2], (I-Cos[2a2])Sin[2a1]+Cos[2a1]Sin[2a2]};
  Solve[Vets[[1]] == 1 && Vets[[2]] == 0 && 0<=a1<=2Pi && 0<=a2<=2Pi, {a1,a2}]

but it gives errors:

Solve::nsmet: This system cannot be solved with the methods available to Solve.

I looked up the documents for Solve function and it should be no problem with the above code. But it doesn't do anything and give errors, I don't understand why?

It will be super cool if anyone could answer this question, thank you very much in advance!

$\endgroup$

2 Answers 2

6
$\begingroup$
Clear["Global`*"]

Vets = {Cos[2 a1] (I + Cos[2 a2]) + Sin[2 a1] Sin[2 a2], 
    (I - Cos[2 a2]) Sin[2 a1] + Cos[2 a1] Sin[2 a2]};

The complex-valued solutions are periodic. You can set the arbitrary constants to specific values, e.g.,

sol0 = Solve[Vets[[1]] == 1 && Vets[[2]] == 0, {a1, a2}] /. 
   {C[1] -> 0, C[2] -> 0}

(* {{a1 -> 1/2 ArcTan[I/2, -(Sqrt[5]/2)], 
  a2 -> 1/2 ArcTan[2 I, -Sqrt[5]]}, {a1 -> 1/2 ArcTan[I/2, Sqrt[5]/2], 
  a2 -> 1/2 ArcTan[2 I, Sqrt[5]]}} *)

sol0n = sol0 // N

(* {{a1 -> -0.785398 + 0.240606 I, 
  a2 -> -0.785398 + 0.721818 I}, {a1 -> 0.785398 - 0.240606 I, 
  a2 -> 0.785398 - 0.721818 I}} *)

Or restrict the complex variables to a region

sol1 = Solve[
  Vets[[1]] == 1 && 
   Vets[[2]] == 0 && 0 < Abs[a1] < Pi/2 && 0 < Abs[a2] < Pi/2, {a1, 
   a2}, Method -> Reduce]

(* {{a1 -> -I ArcTanh[(1 + 2 I)/Sqrt[5]], 
  a2 -> -I ArcTanh[(2 + I)/Sqrt[5]]}, {a1 -> I ArcTanh[(1 + 2 I)/Sqrt[5]], 
  a2 -> I ArcTanh[(2 + I)/Sqrt[5]]}} *)

sol1n = sol1 // N

(* {{a1 -> 0.785398 - 0.240606 I, 
  a2 -> 0.785398 - 0.721818 I}, {a1 -> -0.785398 + 0.240606 I, 
  a2 -> -0.785398 + 0.721818 I}} *)

EDIT: These solutions are equivalent

Thread[({a1, a2} /. sol0[[1]]) - ({a1, a2} /. sol1[[2]])] // 
  ComplexExpand // FullSimplify

(* {0, 0} *)

Thread[({a1, a2} /. sol0[[2]]) - ({a1, a2} /. sol1[[1]])] // 
  ComplexExpand // FullSimplify

(* {0, 0} *)
$\endgroup$
1
  • $\begingroup$ wow, cool. Thank you very much! $\endgroup$
    – Xuemei
    Dec 20, 2020 at 18:20
3
$\begingroup$

This way Mma doesn't give a warning and states that there is no solution:

Vets = {Cos[2 a1] (I + Cos[2 a2]) + Sin[2 a1] Sin[2 a2], (I - Cos[2 a2]) Sin[2 a1] + 
    Cos[2 a1] Sin[2 a2]} // TrigToExp;
Solve[Vets[[1]] == 1 && Vets[[2]] == 0 && 0 <= a1 <= 2 Pi && 0 <= a2 <= 2 Pi, {a1, a2}]

If to remove the condition for a1, a2to be real,

 Vets = {Cos[2 a1] (I + Cos[2 a2]) + Sin[2 a1] Sin[2 a2], (I - Cos[2 a2]) Sin[2 a1] + 
        Cos[2 a1] Sin[2 a2]} // TrigToExp;
    Solve[Vets[[1]] == 1 && Vets[[2]] == 0, {a1, a2}]

it gives 4 series of complex solutions.

$\endgroup$
5
  • $\begingroup$ thank you for the answer. Is there any way to limit the range for the variables in a easy way? $\endgroup$
    – Xuemei
    Dec 20, 2020 at 17:36
  • $\begingroup$ I think the way you applied is very easy and I don't know any better for this case. In the documentation there is a way $\{x,y,\ldots\}\in reg$ specifying a region $reg$. $\endgroup$
    – Andrew
    Dec 20, 2020 at 17:42
  • $\begingroup$ By the way |Vets|^2 is equal to 2 for real values of parameters: FullSimplify[Norm[Vets]^2, {a1, a2} [Element] Reals], so the system indeed doesn't have such solutions. $\endgroup$
    – Andrew
    Dec 20, 2020 at 17:45
  • $\begingroup$ well, you are right. let's take a simple case Vets = {Cos[2a1] + Sin[2a2] , Sin[2a1] + Sin[2a2]} (for sure we know the results easily but how can one restirct the range for a1 and a2 such that one doesn't get the periodic results?) $\endgroup$
    – Xuemei
    Dec 20, 2020 at 17:59
  • $\begingroup$ The way you used works: Solve[Vets[[1]] == 1 && Vets[[2]] == 0 && 0 <= a1 < Pi && 0 <= a2 < Pi, {a1, a2}] $\endgroup$
    – Andrew
    Dec 20, 2020 at 18:06

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.