sin() 함수, cos() 함수
[In]
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
def my_sin(x):
return np.sin(x) # y = sin(x)
def my_cos(x):
return np.cos(x) # y = cos(x)
x = np.linspace(-np.pi, np.pi, 1000)
y_sin = my_sin(x)
y_cos = my_cos(x)
plt.plot(x, y_sin, label = 'sin')
plt.plot(x, y_cos, label = 'cos')
plt.legend()
plt.xlabel('x', size = 14)
plt.ylabel('y', size = 14)
plt.grid()
plt.show()
[Out]
tan() 함수
[In]
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
def my_tan(x):
return np.tan(x)
x = np.linspace(-1.3, 1.3, 1000) # -1.3 rad부터 1.3 rad까지
y = my_tan(x) # y = tan(x)
plt.plot(x, y, label = 'tan')
plt.legend()
plt.xlabel('x', size = 14)
plt.ylabel('y', size = 14)
plt.grid()
plt.show()
[Out]