TransWikia.com

Solving trigonometric equations with two variables in fixed range?

Mathematica Asked on April 3, 2021

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!

2 Answers

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.

Answered by Andrew on April 3, 2021

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} *)

Answered by Bob Hanlon on April 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP