title: Math methods inside classes in Python
body: <p>I'm very new to classes in Python. Was trying to implement a very simple one that is for an exponential function y = a * exp(-b*x).
  Here is my code:</p>
  
  <pre><code>class DR(object):
  
      def __init__(self, a, b):
          self.a = a
          self.b = b
  
      def value(self,x):
          return self.a * exp(-self.b * x)
  </code></pre>
  
  <p>When i instantiate this class with:</p>
  
  <pre><code>f = DR(1.0, 0.1)
  </code></pre>
  
  <p>followed by </p>
  
  <pre><code>f.value(1)
  </code></pre>
  
  <p>I get a Nameerror: global name 'exp' is not defined. I realise that I probably need to import math or numpy modules, but not sure where/how in the class.</p>