Advertisement
taoyu

Untitled

Dec 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #How to plot a function in python:
  2.  
  3. xspace = np.linspace(0 , 2 , 1000)
  4. # = np.linspace(start , end , number of points)
  5.  
  6. def f(x):
  7. return x**2 + 2*x + 1 #Type in your function here
  8.  
  9. plt.plot(xspace, f(xspace), 'k--', label=r'Hello') #Use xspace on this line rather than x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement