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

plt.plot(np.cos(x),np.sin(x),'k')

plt.plot([-1.1,1.1],[0,0],'--',color=[.8,.8,.8])
plt.plot([0,0],[-1.1,1.1],'--',color=[.8,.8,.8])

angle = np.pi/4
plt.plot([0,np.cos(angle)],[0,np.sin(angle)])

plt.axis('square')
plt.axis([-1.1,1.1,-1.1,1.1])
plt.xlabel('xos(x)')
plt.ylabel('sin(y)')

plt.show()
3.141592653589793
[0.         0.06346652 0.12693304 0.19039955 0.25386607 0.31733259
 0.38079911 0.44426563 0.50773215 0.57119866 0.63466518 0.6981317
 0.76159822 0.82506474 0.88853126 0.95199777 1.01546429 1.07893081
 1.14239733 1.20586385 1.26933037 1.33279688 1.3962634  1.45972992
 1.52319644 1.58666296 1.65012947 1.71359599 1.77706251 1.84052903
 1.90399555 1.96746207 2.03092858 2.0943951  2.15786162 2.22132814
 2.28479466 2.34826118 2.41172769 2.47519421 2.53866073 2.60212725
 2.66559377 2.72906028 2.7925268  2.85599332 2.91945984 2.98292636
 3.04639288 3.10985939 3.17332591 3.23679243 3.30025895 3.36372547
 3.42719199 3.4906585  3.55412502 3.61759154 3.68105806 3.74452458
 3.8079911  3.87145761 3.93492413 3.99839065 4.06185717 4.12532369
 4.1887902  4.25225672 4.31572324 4.37918976 4.44265628 4.5061228
 4.56958931 4.63305583 4.69652235 4.75998887 4.82345539 4.88692191
 4.95038842 5.01385494 5.07732146 5.14078798 5.2042545  5.26772102
 5.33118753 5.39465405 5.45812057 5.52158709 5.58505361 5.64852012
 5.71198664 5.77545316 5.83891968 5.9023862  5.96585272 6.02931923
 6.09278575 6.15625227 6.21971879 6.28318531]

Exercise

In [3]:
display(Math('x = (-3,1.83)'))
display(Math('k = e^x'))
$\displaystyle x = (-3,1.83)$
$\displaystyle k = e^x$
In [4]:
x = np.linspace(-3,1.83,50)
print(x)
k = np.exp(x)
print(k)

for i in k:
    plt.plot([0,np.cos(i)],[0,np.sin(i)])
    
plt.axis('square')
plt.axis('off')

plt.show()
[-3.         -2.90142857 -2.80285714 -2.70428571 -2.60571429 -2.50714286
 -2.40857143 -2.31       -2.21142857 -2.11285714 -2.01428571 -1.91571429
 -1.81714286 -1.71857143 -1.62       -1.52142857 -1.42285714 -1.32428571
 -1.22571429 -1.12714286 -1.02857143 -0.93       -0.83142857 -0.73285714
 -0.63428571 -0.53571429 -0.43714286 -0.33857143 -0.24       -0.14142857
 -0.04285714  0.05571429  0.15428571  0.25285714  0.35142857  0.45
  0.54857143  0.64714286  0.74571429  0.84428571  0.94285714  1.04142857
  1.14        1.23857143  1.33714286  1.43571429  1.53428571  1.63285714
  1.73142857  1.83      ]
[0.04978707 0.05494467 0.06063657 0.06691811 0.07385037 0.08150077
 0.08994369 0.09926125 0.10954405 0.12089207 0.13341567 0.14723663
 0.16248934 0.17932214 0.1978987  0.21839966 0.24102439 0.26599289
 0.29354795 0.32395753 0.35751733 0.39455371 0.4354268  0.48053407
 0.53031415 0.5852511  0.64587916 0.71278786 0.78662786 0.86811718
 0.95804824 1.05729556 1.16682422 1.28769931 1.42109624 1.56831219
 1.73077871 1.91007567 2.10794657 2.32631557 2.56730611 2.83326164
 3.12676837 3.4506804  3.80814753 4.20264583 4.63801148 5.11847807
 5.64871774 6.23388666]