sorry if the title does not make sense, I am relatively new to this. This is my code:
class MeanFlow:
def __init__(self, V0=1):
self.V0 = V0
def LHS(self, t, y):
return y[0]*self.V0
def velocity_field(w,f):
z = 0 # dummy
u = f(z,w).real
v = -1*f(z,w).imag
return u, v
w0 = 1
mean = MeanFlow()
dwdz = mean.LHS
print(velocity_field(w0, dwdz))
But I get the error TypeError: 'int' object has no attribute '__getitem__'
My question is how do I pass this function which is a method of my class instance into another function. If I define the function outside the class and pass it to another function this works but is not what I want. Thanks!
Edit: The typo return = y[0]*self.V0
has been corrected.