Trigonometry Calculator
This HTML code creates a simple, interactive trigonometry calculator. It allows users to input an angle in degrees and select a trigonometric function—sine, cosine, tangent, cotangent, secant, or cosecant—from a dropdown menu. With a single click of a button, the calculator computes the result and displays it to the user. The design is clean and responsive, making it accessible on various devices.
Example Calculations
Example 1: Calculating Sine
- Input: Angle = 30°, Function = Sine (sin)
- Process: The input angle (30°) is converted to radians:
30 * (π / 180) ≈ 0.5236 radians
. The sine of this angle is computed usingMath.sin(0.5236) ≈ 0.5
. - Output:
The result of sin(30°) is: 0.5
Example 2: Calculating Tangent
- Input: Angle = 45°, Function = Tangent (tan)
- Process: The input angle (45°) is converted to radians:
45 * (π / 180) ≈ 0.7854 radians
. The tangent of this angle is computed usingMath.tan(0.7854) ≈ 1
. - Output:
The result of tan(45°) is: 1
Example 3: Calculating Secant
- Input: Angle = 60°, Function = Secant (sec)
- Process: The input angle (60°) is converted to radians:
60 * (π / 180) ≈ 1.0472 radians
. The secant is computed as the reciprocal of the cosine:1 / Math.cos(1.0472) ≈ 2
. - Output:
The result of sec(60°) is: 2