Mathematics in C#: Trigonometry 

Introduction 
A circle is a group or series of distinct points drawn at an exact same distance from another point referred to as the center. The distance from the center C to one of these equidistant points is called the radius, R. The line that connects all of the points that are equidistant to the center is called the circumference of the circle. The diameter is the distance between two points of the circumference to the center; in other words, a diameter is double the radius. 
To manage the measurements and other related operations, the circumference is divided into 360 portions. Each of these portions is called a degree. The unit used to represent the degree is the degree, written as ˚. Therefore, a circle contains 360 degrees, that is 360˚. The measurement of two points A and D of the circumference could have 15 portions of the circumference. In this case, this measurement would be represents as 15˚. The distance between two equidistant points A and B is a round shape geometrically defined as an arc. An angle, ө, is the ratio of the distance between two points A and B of the circumference divided by the radius R. This can be written as: Therefore, an angle is the ratio of an arc over the radius. Because an angle is a ratio and not a “physical” measurement, which means an angle is not a dimension, it is independent of the size of a circle. Obviously this angle represents the number of portions included by the three points. A better unit used to measure an angle is the radian or rad. A cycle is a measurement of the rotation around the circle. Since the rotation is not necessarily complete, depending on the scenario, a measure is made based on the angle that was covered during the rotation. A cycle could cover part of the circle in which case the rotation would not have been completed. A cycle could also cover the whole 360˚ of the circle and continue there after. A cycle is equivalent to the radian divided by 2 * Pi.
The word п, also written as Pi, is a constant number used in various mathematical calculations. Its approximate value is 3.1415926535897932. The calculator of Windows represents it as 3.1415926535897932384626433832795. Borland had included its value in the math.h library as M_PI 3.14159265358979323846. A diameter is two times the radius. In geometry, it is written as 2R. In C++, it is written as 2 * R or R * 2 (because the multiplication is symmetric). The circumference of a circle is calculated by multiplying the diameter to Pi, which is 2Rп, or 2 * R * п or 2 * R * Pi. A radian is 2Rп/R radians or 2Rп/R rad, which is the same as 2п rad or 2 * Pi rad. To perform conversions between the degree and the radian, you can use the formula: 360˚ = 2п rad which is equivalent to 1 rad = 360˚ / 2п = 57.3˚.
Consider the following geometric figure:
Consider AB the length of A to B, also referred to as the hypotenuse. Also consider AC the length of A to C which is the side adjacent to point A. The cosine of the angle at point A is the ratio AC/AB. That is, the ratio of the adjacent length, AC, over the length of the hypotenuse, AB: The returned value, the ratio, is a doubleprecision number between –1 and 1. To calculate the cosine of an angle, the Math class provides the Cos() method. Its syntax is: public static double Cos(double d); Here is an example: using System; class Program { static int Main() { int number = 82; Console.WriteLine("The cosine of {0} is {1}", number, Math.Cos(number)); return 0; } } This would produce: The cosine of 82 is 0.949677697882543 Press any key to continue . . .
Consider AB the length of A to B, also called the hypotenuse to point A. Also consider CB the length of C to B, which is the opposite side to point A. The sine represents the ratio of CB/AB; that is, the ratio of the opposite side, CB over the hypotenuse AB. To calculate the sine of a value, you can call the Sin() method of the Math class. Its syntax is: public static double Sin(double a); Here is an example: using System; class Program { static int Main() { double number = 82.55; Console.WriteLine("The sine of {0} is {1}", number, Math.Sin(number)); return 0; } } This would produce: The sine of 82.55 is 0.763419622322519 Press any key to continue . . .
Consider AC the length of A to C. Also consider BC the length of B to C. The tangent is the result of BC/AC; that is, the ratio of BC over AC. To assist you with calculating the tangent of of a number, the Math class is equipped with a method named Tan whose syntax is: public static double Tan(double a); Here is an example: using System; class Program { static int Main() { uint number = 225; Console.WriteLine("The tangent of {0} is {1}", number, Math.Tan(number)); return 0; } } This would produce: The tangent of 225 is 2.53211499233434 Press any key to continue . . .
Consider BC the length of B to C. Also consider AC the length of A to C. The arc tangent is the ratio of BC/AC. To calculate the arc tangent of a value, you can use the Math.Atan() method. Its syntax is public static double Atan(double d); Here is an example: using System; class Program { static int Main() { short number = 225; Console.WriteLine("The arc tangent of {0} is {1}", number, Math.Atan(number)); return 0; } } This would produce: The arc tangent of 225 is 1.56635191161394 Press any key to continue . . .



Previous  Copyright © 20062014 FunctionX, Inc.  
