title: How to plot a function defined with def?
body: <p>I have a function</p>
  
  <pre><code>np.sin(x / 2.) * np.exp(x / 4.) + 6. * np.exp(-x / 4.)
  </code></pre>
  
  <p>and I can plot it by using following code:</p>
  
  <pre><code>x = np.arange(-5, 15, 2)
  y = np.sin(x / 2.) * np.exp(x / 4.) + 6. * np.exp(-x / 4.)
  plt.plot(x, y)
  plt.show()
  </code></pre>
  
  <p>but if I define function plotting doesn't work:</p>
  
  <pre><code>rr = np.arange(-5, 15, 2)
  
  def y(o): 
      return np.sin(o / 2.) * np.exp(o / 4.) + 6. * np.exp(-o / 4.)
  
  def h(b):
      return int(y(b))
  
  plt.plot(rr, h)
  plt.show()
  </code></pre>
  
  <p>Why does it happen, and how could I change the code to plot the function?</p>