# [✓] Solve systems of equations with trigonometric expressions?

Posted 1 year ago
1857 Views
|
3 Replies
|
2 Total Likes
|
 I am fairly new to Mathematica, so this may be a simplistic question, but I want to learn. I know how to use the Solve function to solve a single equation like this: Solve[Cot[c Degree] == 5.792, c] and I know how to use Solve to solve a system of multiple equations like this: Solve[{5*j + 2*r == 5, 6*j - 3*r == 9}, {j, r}] However, when I try to solve a system of multiple equations that involves trigonometric expressions like this (some variables previously defined): Solve[{Fr == Cos[phi Degree]*Fb + Sin[theta Degree]*Fa, 0 == Cos[theta Degree]*Fa - Sin[phi Degree]*Fb}, {Fa, theta}] // N I get only a partially correct answer along with some results that are difficult to understand: {{Fa -> -883.103, theta -> ConditionalExpression[57.2958 (-2.10618 + 6.28319 C), C \[Element] Integers]}, {Fa -> 883.103, theta -> ConditionalExpression[57.2958 (1.03541 + 6.28319 C), C \[Element] Integers]}} What do I need to do to get Mathematica to give me a value of theta in degrees? I am sure there is a straightforward solution, but I just can't seem to find it. Thank you! Answer
3 Replies
Sort By:
Posted 1 year ago
 A ConditionalExpression is valid only if the given condition is satisfied. In this case, C must be an integer coefficient. The solution don't seem problematic to me: eqs = {Fr == Cos[phi Degree] Fb + Sin[theta Degree] Fa, 0 == Cos[theta Degree] Fa - Sin[phi Degree] Fb}; sol = Simplify@Solve[eqs, {Fa, theta}]; Simplify[eqs /. sol, Element[C, Integers]] You get single solutions by giving integer numerical values to C: Simplify[sol /. C -> 3] Answer
Posted 1 year ago
 Thank you, Gianluca. I appreciate you taking the time to respond. I am not able to get that work for me. It makes sense to me that theta would be valid over a certain given range. The problem these equations I am trying to solve represent is a basic statics/physics problem, so the angels are definitely between 0 and 360 degrees. Does your statement that I can get single solutions by giving integer numerical values to C somehow tell Mathematica to only consider values of theta (and phi for that matter) that are between 0 and 360? I apologize for my novice understanding of Mathematica and its terminology. Answer
Posted 1 year ago
 Although I don't really understand what you want to do I think there is another possible approach. For the time being I forget the Degrees, any angles may be easily converted to degrees later on.Your second equation is easily solved for Sin [ phi ] In:= Fr1 = Fb Cos[phi] + Fa Sin[theta]; lsg = Solve[0 == Fa Cos[theta] - Fb Sin[phi], Sin[phi]] // Flatten Out= {Sin[phi] -> (Fa Cos[theta])/Fb} In your first equation convert Cos [ phi ] to a Sin-expression and and put the solution for Sin [ phi ] in In:= Fr2 = Fr1 /. Cos[phi] -> Sqrt[1 - Sin[phi]^2] Out= Fb Sqrt[1 - Sin[phi]^2] + Fa Sin[theta] In:= Fr3 = Fr2 /. lsg Out= Fb Sqrt[1 - (Fa^2 Cos[theta]^2)/Fb^2] + Fa Sin[theta] Simplify this a bit In:= Fr4 = Simplify[Fr3 /. a_ Sqrt[x_] -> Sqrt[a^2 x]] Out= Sqrt[Fb^2 - Fa^2 Cos[theta]^2] + Fa Sin[theta] and solve for theta In:= Solve[Fr4 == Fr, theta] During evaluation of In:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >> Out= { {theta -> -ArcCos[-( Sqrt[-Fa^4 + 2 Fa^2 Fb^2 - Fb^4 + 2 Fa^2 Fr^2 + 2 Fb^2 Fr^2 - Fr^4]/(2 Fa Fr))]}, {theta -> ArcCos[-(Sqrt[-Fa^4 + 2 Fa^2 Fb^2 - Fb^4 + 2 Fa^2 Fr^2 + 2 Fb^2 Fr^2 - Fr^4]/(2 Fa Fr))]}, {theta -> -ArcCos[ Sqrt[-Fa^4 + 2 Fa^2 Fb^2 - Fb^4 + 2 Fa^2 Fr^2 + 2 Fb^2 Fr^2 - Fr^4]/(2 Fa Fr)]}, {theta -> ArcCos[Sqrt[-Fa^4 + 2 Fa^2 Fb^2 - Fb^4 + 2 Fa^2 Fr^2 + 2 Fb^2 Fr^2 - Fr^4]/(2 Fa Fr)]}} To get real solutions you should consider the expression under the square root, which in this case must be > 0 In:= Factor[-Fa^4 + 2 Fa^2 Fb^2 - Fb^4 + 2 Fa^2 Fr^2 + 2 Fb^2 Fr^2 - Fr^4] Out= -(Fa - Fb - Fr) (Fa + Fb - Fr) (Fa - Fb + Fr) (Fa + Fb + Fr) Showing that one or three factors must be negative. Answer