-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathComplementary_Angles_Problem_(θ=30°).py
More file actions
48 lines (40 loc) · 1.42 KB
/
Complementary_Angles_Problem_(θ=30°).py
File metadata and controls
48 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import numpy as np
import pandas as pd
import sympy as sp
import matplotlib.pyplot as plt
# Define the complementary angles problem solver
def solve_complementary_angles(angle):
angle_rad = np.deg2rad(angle)
complementary_angle_rad = np.deg2rad(90 - angle)
sin_result = np.sin(complementary_angle_rad)
cos_result = np.cos(angle_rad)
tan_result = np.tan(complementary_angle_rad)
cot_result = 1 / tan_result
sec_result = 1 / cos_result
cosec_result = 1 / sin_result
results = {
'sin(90° - θ)': sin_result,
'cos(θ)': cos_result,
'tan(90° - θ)': tan_result,
'cot(90° - θ)': cot_result,
'sec(90° - θ)': sec_result,
'cosec(90° - θ)': cosec_result
}
return results
# Example angle
angle = 30
# Solve the complementary angles problem
results = solve_complementary_angles(angle)
# Convert the results to a Pandas DataFrame for easy visualization
results_df = pd.DataFrame.from_dict(results, orient='index', columns=['Value'])
# Create a bar plot to visualize the results
plt.figure(figsize=(10, 6))
plt.bar(results_df.index, results_df['Value'], color='skyblue')
plt.xlabel('Trigonometric Function')
plt.ylabel('Value')
plt.title(f'Complementary Angles Problem (θ = {angle}°)')
plt.ylim(-1.2, 1.2)
plt.axhline(0, color='black', linewidth=0.5, linestyle='--')
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.xticks(rotation=45)
plt.show()