# Use NSolve for a variable in degrees?

Posted 1 month ago
557 Views
|
6 Replies
|
3 Total Likes
|
 Hi! This is my first thread here, so I'm sorry if I missed any formatting rules or such, but I had a question:I'm somewhat new to Mathematica so I'm having some issues, here, I'm trying to use the program to do my trig homework. Basically, I need to use the law of sines to solve triangles. I'm given certain angles (in degrees) and side lengths, and I have to give all side lengths and angles (in degrees again). Here is the problem:Using sin(a)/A=sin(b)/B=sin(c)/C, if I'm given, for example, a=40 degrees; A=2, b=20 degrees, I can plug in NSolve[Sin[40Degree]/4 == Sin[20Degree]/b, b, 3], and I can use this to find B (I rounded to 2 decimals because I'm asked to round to the nearest whole number, and I haven't learned rounding yet, so I use NSolve and round). Of course, I can find the 3rd angle by using 180-a-b and repeat the process so, as far as that goes, I'm good.Now, if I'm given a, A, B, and told to find all 3 angles and sides, I plug this in: NSolve[Sin[20 Degree]/4 == Sin[b/Degree]/6, b, 3] When I go to run this, here's what it gives: I know I could just do the cross multiplication but, well, this stuff is just all very easy but tedious work I'm trying to slowly learn how to do, so that I can eventually do all of my tedious work this way without having to bother using a lot of loose-leaf, so, does anyone know how to make Mathematica just output a straight up answer b-> answer in degrees, with just one line of code I could just change the numbers on for each triangle? Thanks!
6 Replies
Sort By:
Posted 1 month ago
 Also, by the way, it would be cool to know if there is a way to quickly make a code so that I can eventually plug in the angles and sides I'm given, and have Mathematica output all 3 angles and sides? Thanks for your help!
Posted 1 month ago
 If a = 40 Degree and A = 2, why Sin[40 Degree] / 4?
Posted 1 month ago
 That was just an accidental mistake, I just saw it too while rereading my thread.
Posted 1 month ago
 In this case NSolve will in general return 2 solutions, if the solutions are restricted to be in the triangle angle range 0 to 180 degrees In[1]:= Replace[b, NSolve[Sin[20 Degree]/4 == Sin[b]/6 && 0 < b < 180 Degree, b]]/Degree // Round Out[1]= {31, 149}