In [1]:
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
x = np.linspace(0,6*np.pi,100)

plt.plot(x,np.sin(x),'r',label='$\\sin(\\theta)$')
plt.plot(x,np.cos(x),'b',label='$\\cos(\\theta)$')

plt.legend()
plt.xlabel('rad.')
plt.ylabel('function value')
plt.show()
In [3]:
th = np.linspace(0,4*np.pi,100)

plt.plot(th,np.tan(th),'k')
plt.ylim([-5,5])
plt.show()
In [4]:
ang = np.random.rand()*2*np.pi
print(ang)

tan = np.tan(ang)
print(tan)

sc = np.sin(ang) / np.cos(ang)
print(sc)

print(tan - sc)
4.989387461457355
-3.517319492474183
-3.517319492474183
0.0
In [5]:
#c**2 + s**2 = 1
thetas = np.linspace(0,2*np.pi,5)
print(thetas)

print(np.cos(thetas)**2 + np.sin(thetas)**2)
[0.         1.57079633 3.14159265 4.71238898 6.28318531]
[1. 1. 1. 1. 1.]