SoCoder -> Article Home -> Advanced Techniques
Created : 18 September 2013
Edited : 18 September 2013
Maths 101 - Episode 0: Degrees and RadiansAn introduction to a series of maths articles, starting with an overview of degrees and radians
Hello everyone! So, I've decided to write a few articles on various interesting bits of maths, most of which will probably be applicable to some coding task or another, as well as for general interest. Different topics will be split across different posts, and we'll see how it goes! I'm open to any questions or requests.
DegreesChances are you already know what degrees are, but I'm going to briefly define them here for ease of comparison to radians in a minute.
Degrees are a unit, but rather than measuring length, weight or time, they measure angles. A full rotation is defined to be 360 degrees. Why 360? It's a hang-on from the base-60 counting methods of old, and is useful because 360 is actually divisible by quite a lot of numbers.
We use degrees because they're easy for us to deal with. But if you've ever done any coding with trigonometric functions (sin, cos, etc, which I'll cover next time), you may have found, depending on the language you're using, that the functions do not give the results you expect. This is probably because those functions were set to use radians rather than degrees.
RadiansRadians are a different unit for measuring angles, like how metres and feet are different measures for length. One radian is approximately equal to 57.3 degrees, but this is not a good definition.
The true definition of a radian is this: imagine you have a sector of a circle (shown below). This sector will enclose an angle, which we shall call theta (theta, written θ, is the Greek letter often used to represent angles), and will also have a radius, which we shall call r.
The angle theta will have a value of 1 radian if the length of the arc that encloses the sector is equal to r, the radius.
Simple! But why should we care? Surely degrees are a much more intuitive way of measuring angles? Well, it turns out that the radian has lots of interesting mathematical properties that make it much easier to do maths if we use radians instead of degrees.
For instance: the ratio of the radius of a sector to the length of its arc is constant, so if we have a sector with angle theta radians, then the length of the arc is equal to theta * r. Now, there are exactly 2*pi radians in a complete rotation, so as a consequence of this, the circumference of a circle is the angle it encloses multiplied by its radius - so 2 * pi * r!
So, that's degrees and radians. I thought it would be useful to get this out of the way now, to avoid problems for next time, when we will look at some trigonometry.
BONUS ROUND: GradiansThis section is something of an extended footnote for those who are interested, and can happily be ignored. Gradians (or grads) are a third unit for angles, which you may have noticed floating around if you've ever played about with a scientific calculator.
Gradians were invented by the French back when the metric system was gaining popularity. They figured it would be good to measure our angles in metric as well, so invented grads, where one right angle was equal to 100 grads (rather than 90 degrees), making one full rotation equal to 400 grads.
Of course, 360 is divisible by many more numbers than 400 (for instance, the very useful 30 degrees is an awkward 33⅓ grads), so it never caught on. They're all but forgotten now, and serve no particularly useful purpose.