In [1]:
import numpy as np
import sympy as sym
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
display(Math('y_1 = \\sin (\\theta + \\cos (\\theta))'))
display(Math('y_2 = \\cos (\\theta + \\sin (\\theta))'))
$\displaystyle y_1 = \sin (\theta + \cos (\theta))$
$\displaystyle y_2 = \cos (\theta + \sin (\theta))$
In [3]:
x = np.linspace(-2*np.pi,2*np.pi,200)

y1 = np.sin(x + np.cos(x))
y2 = np.cos(x + np.sin(x))

plt.plot(x,y1, x,y2)
plt.legend(['sin(x+cos(x))','cos(x+sin(x))'])
plt.show()
In [4]:
thsym = sym.pi*7/6
theta = float(thsym)

# plot the unit circle
x = np.linspace(0,2*np.pi,200)
plt.plot(np.cos(x),np.sin(x),color='gray')
plt.plot([-1.1,1.1],[0,0],'--',color='gray')
plt.plot([0,0],[-1.1,1.1],'--',color='gray')

plt.plot(np.cos(np.linspace(0,theta)),np.sin(np.linspace(0,theta)),'k',linewidth=3)
plt.plot([0,np.cos(theta)],[0,np.sin(theta)],'k:')
plt.plot(np.cos(theta),np.sin(theta),'ko')

plt.plot([0,0],[0,np.sin(theta)],'r',label='sin')
plt.plot([0,np.cos(theta)],[np.sin(theta),np.sin(theta)],'r:')
plt.plot([0,np.cos(theta)],[0,0],'b',label='cos')
plt.plot([np.cos(theta),np.cos(theta)],[0,np.sin(theta)],'b:')

plt.title('$\\theta = %s$' %sym.latex(thsym))
plt.gca().set_aspect('equal')
plt.legend()
plt.show()