Trigonometry

Introduction

Measures

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:

Angle

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.

Arc

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.

Practical LearningPractical Learning: Introducing Trigonometry

  1. Start Microsoft Visual Studio and create a new Console App (that supports .NET 8.0 (Long-Term Support) named ObliqueTriangles
  2. In the Solution Explorer, rename Program as Trigonometry (or Trigonometry.cs)

The PI Constant

The letter п, also written as Pi, is a constant number used in various mathematical calculations. Its approximate value is 3.1415926535897932. The calculator of MicrosoftWindows represents it as 3.1415926535897932384626433832795.

To support the Pi constant, the Math class is equipped with a constant named PI.

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.

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˚.

The Sine of a Value

Consider a right triangle as follows:

Trigonometry

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 of an angle represents the ratio of CB/AB; that is, the ratio of the opposite side, CB, over the hypotenuse AB.

In trigonometry, the sine is written as sin. If x is the angle on which you are working. Its sine value would be written as sin(x) (expressed as the sine of x). If the value you want to find is named y, it means you are trying to solve the equation:

y = sin(x)

To let you calculate the sine of a value, the Math class proposes a function named Sin(). Its syntax is:

public static double Sin(double a);

When calling this function, pass the value of the angle. The function would then produce the sine value. Here is an example:

double number = 82.55;

double nbr = Math.Sin(number);

Practical LearningPractical Learning: Introducing the Sine Value

  1. Change the document as follows:
    using static System.Console;
    
    void CalculateAAS()
    {
        double angle1 = 0.00, angle2 = 0.00, side1 = 0.00;
    
        WriteLine("AAS Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values: 2 angles and 1 side");
        WriteLine("Sought Values: 1 unknown angle and 2 unknown sides");
        WriteLine("----------------------------------------------------------------------");
    
        try
        {
            Write("AAS Angle 1: ");
            angle1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the lower left angle of the AAS shape.");
        }
    
        try
        {
            Write("AAS Angle 2: ");
            angle2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the lower right angle of the AAS shape.");
        }
    
        try
        {
            Write("AAS Side 1:  ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the right side of the AAS shape.");
        }
    
        // Here, we use the law of sines
        double angle3 = 180 - (angle1 + angle2);
        double side2 = side1 * Math.Sin(angle2 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
        double side3 = side1 * Math.Sin(angle3 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("AAS Angle:   " + angle3.ToString());
        WriteLine("AAS Side 2:  " + side2.ToString());
        WriteLine("AAS Side 3:  " + side3.ToString());
    }
    
    WriteLine("======================================================================");
    WriteLine("This application allows you to make calculations on oblique triangles");
    WriteLine("======================================================================");
    Title = "Oblique Triangles";
    
    CalculateAAS();
    
    WriteLine("======================================================================");
  2. To execute, on the main menu, click Debug -> Start Without Debugging
  3. When requested, type Angle 1 as 58 and press Enter
  4. For Angle 2, type 28 and press Enter
  5. For Side 1, type 6.2
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    AAS Shape
    ----------------------------------------------------------------------
    Known Values: 2 angles and 1 side
    Sought Values: 1 unknown angle and 2 unknown sides
    ----------------------------------------------------------------------
    AAS Angle 1: 58
    AAS Angle 2: 28
    AAS Side 1:  6.2
  6. Press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    AAS Shape
    ----------------------------------------------------------------------
    Known Values: 2 angles and 1 side
    Sought Values: 1 unknown angle and 2 unknown sides
    ----------------------------------------------------------------------
    AAS Angle 1: 58
    AAS Angle 2: 28
    AAS Side 1:  6.2
    ======================================================================
    Results
    ----------------------------------------------------------------------
    AAS Angle:   94
    AAS Side 2:  3.4322625125446042
    AAS Side 3:  7.293097101028194
    ======================================================================
    
    Press any key to close this window . . .
  7. Close the window and return to your programming environment

The Arc Sine of a Number

Now that we have seen how to define the sine of an angle of a right triangle, we can define the opposite of a sine as the arc sine of an angle. In a trigonometric course, the arc sine is written as arcsin. We saw that, if x is an angle, its sine is y = sin(x). In this case, the arc sine is:

x = arcsin(y)

The value of y must be between -1 (included) and 1 (included). To let you calculate the arc sine of an angle, the Math class is equipped with a function named Asin. Its takes one argument. The syntax of this function is:

public static double Asin (double d);

Pass the value of the angle to this function. Here is an example:

using static System.Console;

double number = .746;
double sine = Math.Sin(number);
double arcsine = Math.Asin(number);

WriteLine("The sine of {0} is {1}", number, sine);
WriteLine("The arc sine of {0} is {1}", number, arcsine);
WriteLine("==============================================");

This would produce:

The sine of 0.746 is 0.6787065592497046
The arc sine of 0.746 is 0.842035204195032
==============================================

Press any key to close this window . . .

The Cosine of a Value

Once again, consider the following right triangle:

Trigonometry

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:

Cosine

The returned value, the ratio, is a double-precision 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:

int number = 82;

double nbr = Math.Cos(number);

The Arc Cosine of an Angle

Imagine you have an angle named u in a right triangle. To calculate the value v of the cosine of that angle, you would write:

v = cosin(u)

To let you consider the opposite of a cosine, trigonometry provides the concept of an arc cosine. In trigonometry, it is written arccos. To get the opposite of the cosine of the angle, you would write:

u = arccos(v)

To support arc cosines, the Matt class provides a function named Acos. Its syntax is:

public static double Acos (double d);

To calculate the arc cosine of a value, pass a number to the function. The number must be between -1 and 1. Here is an example:

using static System.Console;

double number = .426;
double cosine = Math.Cos(number);
double arcosine = Math.Acos(number);

WriteLine("The cosine of {0} is {1}", number, cosine);
WriteLine("The arc cosine of {0} is {1}", number, arcosine);
WriteLine("==============================================");

This would produce:

The cosine of 0.426 is 0.9106259567216819
The arc cosine of 0.426 is 1.1307294179513676
==============================================

Press any key to close this window . . .

Practical LearningPractical Learning: Introducing Cosines

  1. Change the Trigonometry.cs document as follows:
    using static System.Console;
    
    void CalculateSAS()
    {
        WriteLine("SAS Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values:  2 sides and 1 angle");
        WriteLine("Sought Values: 1 unknown side and 2 unknown angles");
        WriteLine("----------------------------------------------------------------------");
    
        double side1 = 0.00, angle1 = 0.00, side2 = 0.00;
    
        WriteLine("Type the known values");
    
        try
        {
            Write("SAS Side  1: ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for one of the known sides of the SAS shape.");
        }
    
        try
        {
            Write("SAS Angle 1: ");
            angle1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the known angle of the SAS shape.");
        }
    
        try
        {
            Write("SAS Side  2: ");
            side2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the other known side of the SAS shape.");
        }
    
        // Here, we use the law of cosines
        double side3 = Math.Sqrt((side1 * side1) +
                                 (side2 * side2) -
                                 (2 * side1 * side2 * Math.Cos(angle1 * Math.PI / 180)));
        double angle2 = Math.Acos(((side3 * side3) +
                                   (side2 * side2) -
                                   (side1 * side1)) /
                                   (2 * side3 * side2)) * 180 / Math.PI;
        double angle3 = 180 - (angle1 + angle2);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("SAS Side  3: {0}", side3.ToString());
        WriteLine("SAS Angle 2: {0}", angle2.ToString());
        WriteLine("SAS Angle 3: {0}", angle3.ToString());
    }
    
    WriteLine("======================================================================");
    WriteLine("This application allows you to make calculations on oblique triangles");
    WriteLine("======================================================================");
    Title = "Oblique Triangles";
    
    CalculateSAS();
    
    WriteLine("======================================================================");
  2. To execute, on the main menu, click Debug -> Start Without Debugging
  3. When requested, type the Side 1 as 15
  4. For Angle 1, type 28 and press Enter
  5. For Angle 2, type 43.6 and press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    SAS Shape
    ----------------------------------------------------------------------
    Known Values:  2 sides and 1 angle
    Sought Values: 1 unknown side and 2 unknown angles
    ----------------------------------------------------------------------
    Type the known values
    SAS Side  1: 15
    SAS Angle 1: 28
    SAS Side  2: 43.6
    ======================================================================
    Results
    ----------------------------------------------------------------------
    SAS Side  3: 31.16190861517509
    SAS Angle 2: 13.06071118397518
    SAS Angle 3: 138.93928881602483
    ======================================================================
    
    Press any key to close this window . . .
  6. Close the window and return to Microsoft Visual Studio
    SAS ASA
    Oblique Triangles Oblique Triangles
    Known Values: 2 sides and the 1 angle between them
    Unknown Values: 2 angles and the 1 sides between them
    Known Values: 2 angles and the 1 side joining them
    Unknown Values: 2 sides and the 1 angle between them
    AAS SSS
    Oblique Triangles Oblique Triangles
    Known Values: 2 angles and the 1 side opposite the first angle
    Unknown Values: 2 sides and the 1 angle oppiste the second side
    Known Values: All 3 sides
    Unknown Values: All 3 angles
  7. To complete the application with the other options on oblique triangles, change the document as follows:
    using static System.Console;
    
    void CalculateAAS()
    {
        double angle1 = 0.00, angle2 = 0.00, side1 = 0.00;
    
        WriteLine("AAS Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values:  Known Values: 2 sides and the 1 angle between them");
        WriteLine("Sought Values: 2 angles and the 1 sides between them");
        WriteLine("----------------------------------------------------------------------");
    
        try
        {
            Write("AAS Angle 1: ");
            angle1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the lower left angle of the AAS shape.");
        }
    
        try
        {
            Write("AAS Angle 2: ");
            angle2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the lower right angle of the AAS shape.");
        }
    
        try
        {
            Write("AAS Side 1:  ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the right side of the AAS shape.");
        }
    
        // Here, we use the law of sines
        double angle3 = 180 - (angle1 + angle2);
        double side2 = side1 * Math.Sin(angle2 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
        double side3 = side1 * Math.Sin(angle3 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("AAS Angle:   " + angle3.ToString());
        WriteLine("AAS Side 2:  " + side2.ToString());
        WriteLine("AAS Side 3:  " + side3.ToString());
    }
    
    void CalculateASA()
    {
        double angle1 = 0.00, angle2 = 0.00, side1 = 0.00;
    
        WriteLine("ASA Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values:  2 angles and the 1 side joining them");
        WriteLine("Sought Values: 2 sides and the 1 angle between them");
        WriteLine("----------------------------------------------------------------------");
    
        try
        {
            Write("ASA Angle 1: ");
            angle1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for one of the known angles of the ASA shape.");
        }
    
        try
        {
            Write("ASA Side 1:  ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the side that is between the angles whose values are about the ASA shape.");
        }
    
        try
        {
            Write("AAS Angle 2: ");
            angle2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the other known angle of the ASA oblique triangle.");
        }
    
        // Here, we use the law of sines
        double angle3 = 180 - (angle1 + angle2);
        double side2 = side1 * Math.Sin(angle2 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
        double side3 = side1 * Math.Sin(angle3 * Math.PI / 180) / Math.Sin(angle1 * Math.PI / 180);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("ASA Angle 3: {0}", angle3);
        WriteLine("ASA Side 2:  {0}", side3);
        WriteLine("ASA Side 3:  {0}", side2);
    }
    
    void CalculateSAS()
    {
        WriteLine("SAS Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values:  2 sides and the 1 angle between them");
        WriteLine("Sought Values: 2 angles and the 1 sides between them");
        WriteLine("----------------------------------------------------------------------");
    
        double side1 = 0.00, angle1 = 0.00, side2 = 0.00;
    
        WriteLine("Type the known values");
    
        try
        {
            Write("SAS Side  1: ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for one of the known sides of the SAS shape.");
        }
    
        try
        {
            Write("SAS Angle 1: ");
            angle1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the known angle of the SAS shape.");
        }
    
        try
        {
            Write("SAS Side  2: ");
            side2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the other known side of the SAS shape.");
        }
    
        // Here, we use the law of cosines
        double side3 = Math.Sqrt((side1 * side1) +
                                 (side2 * side2) -
                                 (2 * side1 * side2 * Math.Cos(angle1 * Math.PI / 180)));
        double angle2 = Math.Acos(((side3 * side3) +
                                   (side2 * side2) -
                                   (side1 * side1)) /
                                   (2 * side3 * side2)) * 180 / Math.PI;
        double angle3 = 180 - (angle1 + angle2);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("SAS Side  3: {0}", side3.ToString());
        WriteLine("SAS Angle 2: {0}", angle2.ToString());
        WriteLine("SAS Angle 3: {0}", angle3.ToString());
    }
    
    void CalculateSSS()
    {
        WriteLine("SSS Shape");
        WriteLine("----------------------------------------------------------------------");
        WriteLine("Known Values:  All 3 sides");
        WriteLine("Sought Values: All 3 angles");
        WriteLine("----------------------------------------------------------------------");
    
        double side1 = 0.00, side2 = 0.00, side3 = 0.00;
    
        WriteLine("Type the known values");
    
        try
        {
            Write("SSS Side 1:  ");
            side1 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for one of the known sides of the SSS shape.");
        }
    
        try
        {
            Write("SSS Side 2:  ");
            side2 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for another side of the SSS triangle.");
        }
    
        try
        {
            Write("SSS Side 3:  ");
            side3 = double.Parse(ReadLine()!);
        }
        catch (FormatException)
        {
            WriteLine("You must type a value for the remaining known side of the SSS oblique triangle.");
        }
    
        // Here, we use the law of cosines
        double angle1 = Math.Acos(((side3 * side3) +
                                   (side2 * side2) -
                                   (side1 * side1)) /
                                   (2 * side3 * side2)) * 180 / Math.PI;
        double angle2 = Math.Acos(((side3 * side3) +
                                   (side1 * side1) -
                                   (side2 * side2)) /
                                   (2 * side3 * side1)) * 180 / Math.PI;
        double angle3 = 180 - (angle1 + angle2);
    
        WriteLine("======================================================================");
        WriteLine("Results");
        WriteLine("----------------------------------------------------------------------");
        WriteLine($"SSS Angle 1: {angle1}");
        WriteLine($"SSS Angle 2: {angle2}");
        WriteLine($"SSS Angle 3: {angle3}");
    }
    
    WriteLine("======================================================================");
    WriteLine("This application allows you to make calculations on oblique triangles");
    WriteLine("======================================================================");
    Title = "Oblique Triangles";
    
    WriteLine("Available shape options:");
    WriteLine("1 - AAS (Known: Angle - Angle - Side)");
    WriteLine("2 - ASA (Known: Angle - Side - Angle)");
    WriteLine("3 - SAS (Known: Side - Angle - Side)");
    WriteLine("4 - SSS (Known: Side - Side - Side)");
    WriteLine("Q - Quit");
    Write("What type of triangle do you want to process? ");
    string selection = ReadLine();
    
    switch (selection)
    {
        case null:
            return 10;
        case "1":
            CalculateAAS();
            break;
        case "2":
            CalculateASA();
            break;
        case "3":
            CalculateSAS();
            break;
        case "4":
            CalculateSSS();
            break;
        default:
            return 20;
    }
                
    WriteLine("======================================================================");
  8. To execute the application to test it, on the main menu, click Debug -> Start Without Debugging
  9. For the selection, type 1 and press Enter
  10. For AAS Angle 1, type 43 and press Enter
  11. For AAS Angle 2, type 57 and press Enter
  12. For AAS Side 1, type 4.56 and press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    Available shape options:
    1 - AAS (Known: Angle - Angle - Side)
    2 - ASA (Known: Angle - Side - Angle)
    3 - SAS (Known: Side - Angle - Side)
    4 - SSS (Known: Side - Side - Side)
    Q - Quit
    What type of triangle do you want to process? 1
    AAS Shape
    ----------------------------------------------------------------------
    Known Values:  Known Values: 2 sides and the 1 angle between them
    Sought Values: 2 angles and the 1 sides between them
    ----------------------------------------------------------------------
    AAS Angle 1: 38
    AAS Angle 2: 21
    AAS Side 1:  24
    ======================================================================
    Results
    ----------------------------------------------------------------------
    AAS Angle:   121
    AAS Side 2:  13.970064936315433
    AAS Side 3:  33.41449163433361
    ======================================================================
    
    Press any key to close this window . . .
  13. Close the window and return to your programming environment
  14. To execute the application again, on the main menu, click Debug -> Start Without Debugging
  15. For the selection, type 2 and press Enter
  16. For ASA Angle 1, type 131 and press Enter
  17. For ASA Side 1, type 10 and press Enter
  18. For ASA Angle 2, type 23 and press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    Available shape options:
    1 - AAS (Known: Angle - Angle - Side)
    2 - ASA (Known: Angle - Side - Angle)
    3 - SAS (Known: Side - Angle - Side)
    4 - SSS (Known: Side - Side - Side)
    Q - Quit
    What type of triangle do you want to process? 2
    ASA Shape
    ----------------------------------------------------------------------
    Known Values:  2 angles and the 1 side joining them
    Sought Values: 2 sides and the 1 angle between them
    ----------------------------------------------------------------------
    ASA Angle 1: 131
    ASA Side 1:  10
    AAS Angle 2: 23
    ======================================================================
    Results
    ----------------------------------------------------------------------
    ASA Angle 3: 26
    ASA Side 2:  5.808474654047468
    ASA Side 3:  5.177238221541317
    ======================================================================
    
    Press any key to close this window . . .
  19. Close the window and return to your programming environment
  20. To execute again, on the main menu, click Debug -> Start Without Debugging
  21. For the selection, type 3 and press Enter
  22. For SAS Side 1, type 32 and press Enter
  23. For SAS Angle 1, type 125.2 and press Enter
  24. For SAS Side 2, type 48 and press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    Available shape options:
    1 - AAS (Known: Angle - Angle - Side)
    2 - ASA (Known: Angle - Side - Angle)
    3 - SAS (Known: Side - Angle - Side)
    4 - SSS (Known: Side - Side - Side)
    Q - Quit
    What type of triangle do you want to process? 3
    SAS Shape
    ----------------------------------------------------------------------
    Known Values:  2 sides and the 1 angle between them
    Sought Values: 2 angles and the 1 sides between them
    ----------------------------------------------------------------------
    Type the known values
    SAS Side  1: 32
    SAS Angle 1: 125.2
    SAS Side  2: 48
    ======================================================================
    Results
    ----------------------------------------------------------------------
    SAS Side  3: 71.40588263773233
    SAS Angle 2: 21.481281143555236
    SAS Angle 3: 33.318718856444775
    ======================================================================
    
    Press any key to close this window . . .
  25. Close the window and return to your programming environment
  26. To execute again, on the main menu, click Debug -> Start Without Debugging
  27. For the selection, type 4 and press Enter
  28. For SSS Side 1, type 2.8 and press Enter
  29. For SSS Side 2, type 4.7 and press Enter
  30. For SSS Side 3, type 3.5 and press Enter:
    ======================================================================
    This application allows you to make calculations on oblique triangles
    ======================================================================
    Available shape options:
    1 - AAS (Known: Angle - Angle - Side)
    2 - ASA (Known: Angle - Side - Angle)
    3 - SAS (Known: Side - Angle - Side)
    4 - SSS (Known: Side - Side - Side)
    Q - Quit
    What type of triangle do you want to process? 4
    SSS Shape
    ----------------------------------------------------------------------
    Known Values:  All 3 sides
    Sought Values: All 3 angles
    ----------------------------------------------------------------------
    Type the known values
    SSS Side 1:  2.8
    SSS Side 2:  4.7
    SSS Side 3:  3.5
    ======================================================================
    Results
    ----------------------------------------------------------------------
    SSS Angle 1: 36.34422106309733
    SSS Angle 2: 95.85670190991829
    SSS Angle 3: 47.79907702698438
    ======================================================================
    
    Press any key to close this window . . .
  31. Close the window and return to your programming environment

Tangents

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);

The Arc Tangent

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 static System.Console;

short number = 225;
        
Write("The arc tangent of ");
Write(number);
Write(" is ");
WriteLine(Math.Atan(number));

This would produce:

The arc tangent of 225 is 1.56635191161394
Press any key to close this window . . .

Practical LearningPractical Learning: Ending the Lesson


Previous Copyright © 2001-2024, FunctionX Saturday 23 October 2022 Next