import numpy as np
import matplotlib.pyplot as plt
x = range(-3,4)
y = np.zeros(len(x))
print(x)
print(y)
for i in range(0,len(x)):
y[i] = 2 - x[i]**2
plt.plot(x,y,'s-')
plt.show()
x = np.linspace(-3,3,10)
print(x)
y1 = 2 + np.sqrt(abs(x))
y2 = 2 + abs(x)**(1/3)
plt.plot(x,y1,'ms-')
plt.plot(x,y2,'ks-')
x = np.linspace(-4,4,100)
e = range(-1,4)
for i in e:
y = x**i
#plt.plot(x,y,label='y=x**%s' %i,linewidth=4)
plt.plot(x,y,label='$y=x^{%s}$' %i,linewidth=4) # latex
plt.legend()
plt.xlim([x[0],x[-1]])
plt.ylim([-20,20])
plt.show()