-
Notifications
You must be signed in to change notification settings - Fork 0
/
Trignometric.py
79 lines (52 loc) · 1.1 KB
/
Trignometric.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
'''
Trignometric Function Curve
@author : Suyash Shivaji Phatak
Date = 25\04\2020
'''
# Defining Modules
import numpy as np
import matplotlib.pyplot as plt
# Taking input from user
angle = float(input('\nEnter angle(in radians) to show the curve: '))
'''
1. Sine & Cosine curve
'''
# Sine Curve
# Setting x
x = np.arange(0, angle*(np.pi), 0.1)
# Setting y for sin
y1 = np.sin(x)
# setting y for cos
y2 = np.cos(x)
# Seperating Graphs
plt.figure(1)
# Plotting both points
plt.plot(x, y1,label = 'Sine curve')
plt.plot(x, y2,label = 'Cosine curve')
# Naming the x axis
plt.xlabel('θ')
# Naming the y axis
plt.ylabel('Y')
# Giving a title to graph
plt.title('Sine curve VS Cosine curve')
'''
2. Tangent curve
'''
# Setting x
x3 = np.arange(0, angle*(np.pi), 0.1)
# Setting y
y3 = np.tan(x3)
# Seperating Graphs
plt.figure(2)
# Plotting first points
plt.plot(x3, y3,label = 'Tangent curve')
# Naming the x axis
plt.xlabel('θ')
# Naming the y axis
plt.ylabel('Y')
# Giving a title to graph
plt.title('Tangent Curve')
# Showing legend
plt.legend()
# Function to show the plot
plt.show()