""" Exercise 7.1 from "A primer on... Make a class for representing a parameterized function. """ import numpy as np class F: def __init__(self, a, w): self.a = a self.w = w def value(self, x): return np.exp(-self.a * x) * np.sin(self.w * x) f = F(a=1.0, w=0.1) print(f.value(x=np.pi)) #0.013353835137 f.a = 2 print(f.value(x=np.pi)) #0.00057707154012 """ Terminal> python F.py 0.01335383513703555 0.0005770715401197441 """