Wikipedia:Reference desk/Archives/Mathematics/2024 May 22

= May 22 =

Finding a list of "nice" angles
Hi. Angles such as 30, 45, 60 degrees are commonly used. I am currently using a very inefficient and convoluted process to find similar angles:

1. Draw a right triangle with height 4.0000 and the top angle as 39.0000 degrees. The bottom is then 3.23914.

2. Open up an excel sheet and populate the first column with values from 38.00 to 40.00 in 0.01 degree increments.

3. In the second column input the equation =tan(RADIANS(A1))*4.0000

4. Manually look through the second column to find a "nice" value (using human heuristics), which is 3.25999604

5. Calculate ROUND(3.25999604, 3)/4, which is 0.815

6. Now go back to the original right triangle, and change the angle to =ATN(0.815)

7. The right triangle now has height 4.0000 and the top angle as 39.1800 degrees, and bottom 3.2600

Is there a way to calculate all such "nice" angles in advance in the form of a table? If that were possible, there would be a row with the values: "tan(RADIANS(39.18)) = 0.815". So in step one, I would input height 4.0000, look in the table for an angle close to 39.0000, which is 39.1800, then input =ATN(0.815) as the angle. In that case, I would not need to open Excel and perform steps 2 to 6.

I am not a programmer but I imagine that it should be possible to write a short script to generate all such "nice" angles from 0 to 360 degrees.

Thank you and have a nice day. OptoFidelty (talk) 21:02, 22 May 2024 (UTC)


 * Perhaps Exact trigonometric values might be of use to you? NadVolum (talk) 22:19, 22 May 2024 (UTC)
 * One way to approach it would be to graph the function. So e.g. draw a graph of y = 4 tan(x) in a graph package. Excel e.g. though I've not used it for years so don't know how good its graph drawing is now.
 * Your "nice" angles then can be found when the graph crosses through, or close to, points on your "graph paper", marked to the degree of precision you desire. You might then be able to find these points programatically, or visually, or a combination of both from the graph. --2A04:4A43:90AF:FC35:6CCB:C14C:3818:FDA2 (talk) 23:30, 22 May 2024 (UTC)
 * Thanks, guys. Exact trigonometric values is very close to what I am looking for. OptoFidelty (talk) 15:33, 23 May 2024 (UTC)
 * Does the algebraic (roots) notation exist for the trigonometric values of all angles with integer degrees? 61.224.168.169 (talk) 11:44, 24 May 2024 (UTC)
 * By the Gauss–Wantzel theorem, the angles of integral degree with algebraic trigonometric values are precisely those that are a multiple of 3°. --Lambiam 04:39, 25 May 2024 (UTC)
 * It is not quite clear to me from this one example what makes an angle "nice". Suppose I draw a right triangle with height 7.5 and top angle 52°. I get 9.59956... for the width. This is close to 9.6. Is it close enough for 52° to be nice?
 * Is the following nice: height = 7.9735, angle = 9.0941°, width = 1.2763? If not, why not? --Lambiam 21:02, 23 May 2024 (UTC)
 * @Lambiam The triangle I ended drawing has height 4, top angle 39.1800 degrees, and bottom 3.2599960396627881356849171185262635206102761449606762736889760643... long.
 * On a schematic with a 2 decimal point formatting, the rounded numbers would be height 4.00, top angle 39.18 degrees, and bottom 3.26. In that case, the height and angle are exact, and the bottom number is 0.000121482% off from the exact value.
 * With height = 7.9735, angle = 9.0941°, width = 1.2763, the 2 digit rounded values would be 7.97, 9.09, 1.28. And the rounding error would be slightly larger than my example.
 * "niceness" is entirely subjective and varies from person to person, and from context to context. In this case, it's basically a personal shorthand word I use to describe "when you round the number to X number of decimal points, the rounded number is less than Y% off from the exact measurement".
 * The value of X is determined by the exact drafting standard that I am told to draft in. It commonly varies from 1 to 3. the value of Y is, again, subjective. I personally like to keep it "small", but there is no objective measure on how "small" Y needs to be. OptoFidelty (talk) 21:23, 24 May 2024 (UTC)
 * The values of X and Y need to be fixed if you want to construct a table. The range of heights considered also needs to be made finite. Then it is a somewhat trivial exercise to code an algorithm that enumerates all possibilities and outputs the nice ones. --Lambiam 04:51, 25 May 2024 (UTC)
 * Thank you. Does the value of Y need to be fixed or can it be estimated from the desired number of table rows?
 * For example, if X = 2 and the desired table size is 1000, can Y be estimated from that?
 * Or maybe when given the desired table size, let's say 1000, it's easier just to loop through all possible angles values (360 * 10^X), then just keep the "best" 1000 values then it's done. Y isn't actually needed in that case. OptoFidelty (talk) 13:11, 25 May 2024 (UTC)
 * The notion of "desired table size" is a new element. You can do either – keep all that are nice, or keep the best N, whether nice or not. You can also keep the best N but discard any that are not nice. Which works best for you depends on what you use these tables for. --Lambiam 18:05, 25 May 2024 (UTC)