# Solving trigonometric functions in Mathematica

I am new to Mathematica language and recently I had the need to solve the following equations with two variables, A and B:

(* fi=0.34;
gi=1800;
lam=0.500;
enne=1.5; *)
fun = TrigExpand[gi*lam/enne == Sin[A - fi] + Sin[B + fi]]


I tried:

Solve[fun , B]


with $B(A)$, and then

fun2 = A == -B + 2 fi
Solve[fun2 , A]


but the output is a conditional expression that I do not know how to process further. In fact this equation will be part of a system of equations and its output should be used to solve other parts.

The output in this case is:

    {{brr -> ConditionalExpression[
ArcTan[(enne gi lam Sin[fi] - enne^2 Cos[fi] Sin[arr] Sin[fi] +
enne^2 Cos[arr] Sin[
fi]^2 - \[Sqrt](-enne^2 gi^2 lam^2 Cos[fi]^2 +
enne^4 Cos[fi]^4 + 2 enne^3 gi lam Cos[fi]^3 Sin[arr] -
enne^4 Cos[fi]^4 Sin[arr]^2 -
2 enne^3 gi lam Cos[arr] Cos[fi]^2 Sin[fi] +
2 enne^4 Cos[arr] Cos[fi]^3 Sin[arr] Sin[fi] +
enne^4 Cos[fi]^2 Sin[fi]^2 -
enne^4 Cos[arr]^2 Cos[fi]^2 Sin[fi]^2))/(enne^2 Cos[
fi]^2 + enne^2 Sin[fi]^2), (1/enne)
Sec[fi] (gi lam - enne Cos[fi] Sin[arr] +
enne Cos[arr] Sin[fi] - (enne^2 gi lam Sin[fi]^2)/(
enne^2 Cos[fi]^2 + enne^2 Sin[fi]^2) + (
enne^3 Cos[fi] Sin[arr] Sin[fi]^2)/(
enne^2 Cos[fi]^2 + enne^2 Sin[fi]^2) - (
enne^3 Cos[arr] Sin[fi]^3)/(
enne^2 Cos[fi]^2 +
enne^2 Sin[
fi]^2) + (enne Sin[
fi] \[Sqrt](-enne^2 Cos[
fi]^2 (gi^2 lam^2 - enne^2 Cos[fi]^2 -
2 enne gi lam Cos[fi] Sin[arr] +
enne^2 Cos[fi]^2 Sin[arr]^2 +
2 enne gi lam Cos[arr] Sin[fi] -
2 enne^2 Cos[arr] Cos[fi] Sin[arr] Sin[fi] -
enne^2 Sin[fi]^2 +
enne^2 Cos[arr]^2 Sin[fi]^2)))/(enne^2 Cos[fi]^2 +
enne^2 Sin[fi]^2))] + 2 \[Pi] C[1],
C[1] \[Element] Integers]}, {brr ->
ConditionalExpression[
ArcTan[(enne gi lam Sin[fi] - enne^2 Cos[fi] Sin[arr] Sin[fi] +
enne^2 Cos[arr] Sin[
fi]^2 + \[Sqrt](-enne^2 gi^2 lam^2 Cos[fi]^2 +
enne^4 Cos[fi]^4 + 2 enne^3 gi lam Cos[fi]^3 Sin[arr] -
enne^4 Cos[fi]^4 Sin[arr]^2 -
2 enne^3 gi lam Cos[arr] Cos[fi]^2 Sin[fi] +
2 enne^4 Cos[arr] Cos[fi]^3 Sin[arr] Sin[fi] +
enne^4 Cos[fi]^2 Sin[fi]^2 -
enne^4 Cos[arr]^2 Cos[fi]^2 Sin[fi]^2))/(enne^2 Cos[
fi]^2 + enne^2 Sin[fi]^2), (1/enne)
Sec[fi] (gi lam - enne Cos[fi] Sin[arr] +
enne Cos[arr] Sin[fi] - (enne^2 gi lam Sin[fi]^2)/(
enne^2 Cos[fi]^2 + enne^2 Sin[fi]^2) + (
enne^3 Cos[fi] Sin[arr] Sin[fi]^2)/(
enne^2 Cos[fi]^2 + enne^2 Sin[fi]^2) - (
enne^3 Cos[arr] Sin[fi]^3)/(
enne^2 Cos[fi]^2 +
enne^2 Sin[
fi]^2) - (enne Sin[
fi] \[Sqrt](-enne^2 Cos[
fi]^2 (gi^2 lam^2 - enne^2 Cos[fi]^2 -
2 enne gi lam Cos[fi] Sin[arr] +
enne^2 Cos[fi]^2 Sin[arr]^2 +
2 enne gi lam Cos[arr] Sin[fi] -
2 enne^2 Cos[arr] Cos[fi] Sin[arr] Sin[fi] -
enne^2 Sin[fi]^2 +
enne^2 Cos[arr]^2 Sin[fi]^2)))/(enne^2 Cos[fi]^2 +
enne^2 Sin[fi]^2))] + 2 \[Pi] C[1],
C[1] \[Element] Integers]}}


How can I assume some C[1] values to retrieve the solutions of this equation?

Thank you for the help

• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Feb 20 '16 at 9:47
• (In general it's best not to use capitalised variable names). The output above can be used in other expressions, including Solve. Maybe it is more convincing is you simplify your equation first; try Solve[left == Sin[B + U], B] . – b.gates.you.know.what Feb 20 '16 at 10:19
• @b.gatessucks Thank you! I have edited the question to be more specific about the problem that I'm trying to solve (taking into account that I've to substitute capital letters when passing the equations to Mathematica). – Alessio Zanutta Feb 20 '16 at 10:59

fi = 0.34;
gi = 1800;
lam = 0.500;
enne = 1.5;
fun = TrigExpand[Rationalize[gi*lam/enne == Sin[A - fi] + Sin[B + fi], 0]] // FullSimplify
(* 600 + Sin[17/50 - A] == Sin[17/50 + B] *)

FindInstance[fun, {A, B}] // FullSimplify
(* {{A -> 33/10 + (8 I)/5, B -> -(17/50) - 91 \[Pi] - ArcSin[600 - Sin[74/25 + (8 I)/5]]}} *)

FindInstance[fun, {A, B}, Reals] // FullSimplify
(* {} *)


You get no real solutions! Now we go your way:

b = B /. Solve[fun, B] /. C[1] -> 1
(* {1/50 (-17 + 50 (3 \[Pi] - ArcSin[600 + Sin[17/50 - A]])),
1/50 (-17 + 50 (2 \[Pi] + ArcSin[600 + Sin[17/50 - A]]))} *)

B1 = -b[[1]] + Rationalize[2 fi, 0] // FullSimplify
B2 = -b[[2]] + Rationalize[2 fi, 0] // FullSimplify

Table[B1, {A, -5, 5}] // N
(* {-6.83398 - 7.08873 I, -6.83398 - 7.08852 I, -6.83398 -
7.08975 I, -6.83398 - 7.09127 I, -6.83398 - 7.0917 I, -6.83398 -
7.09063 I, -6.83398 - 7.08905 I, -6.83398 - 7.08841 I, -6.83398 -
7.0893 I, -6.83398 - 7.0909 I, -6.83398 - 7.09174 I} *)

Table[B2, {A, -5, 5}] // N
(* {-6.83398 + 7.08873 I, -6.83398 + 7.08852 I, -6.83398 +
7.08975 I, -6.83398 + 7.09127 I, -6.83398 + 7.0917 I, -6.83398 +
7.09063 I, -6.83398 + 7.08905 I, -6.83398 + 7.08841 I, -6.83398 +
7.0893 I, -6.83398 + 7.0909 I, -6.83398 + 7.09174 I} *)


Your system has no real solutions. In the picture one can see the crossings Re(A) and Re(B2), but the imaginary parts go parallel.

Plot[Evaluate@ReIm[{B2, A}], {A, -10, 10}, PlotTheme -> "Detailed"]