class SHM():
"Class for simple harmonic motion"
# special method to initialise attributes
def __init__(self, k, m):
self.k = k
self.m = m
# special method to display it
def __repr__(self):
return "{} + {}i".format(self.m,self.k)
# method for angular frequency
def ang_freq(self):
return (np.sqrt((self.m)/(self.k))
# method for frequency
def frequency(self):
return ((0.5*np.pi)*(np.sqrt((self.m)/(self.k))))
# method for period
def period(self):
return ((2*np.pi)/(np.sqrt((self.m)/(self.k))))
I have tried multiple things but I can't understand that why when I run the code my def frequency(self):
is saying invalid syntax on the def
.