""" Exercise 7.1 from "A primer on..." Make a class to represent a parameterized function. Very similar to the example from the lecture, just with a different mathematical expression. """ import numpy as np class F: def __init__(self, a, w): self.a = a self.w = w def value(self, x): a = self.a w = self.w return np.exp(-a * x) * np.sin(w * x) #class usage: f = F(a=1.0, w=0.1) print(f.value(x = np.pi)) f.a = 2 print(f.value(x = np.pi)) """ Terminal> python F.py 0.01335383513703555 0.0005770715401197441 """