I'm trying to define a function of 3 unknown variables (k,m,c) but let's say I have to define it 100 times due to a different frequency f each time. Can I do this in a for loop in python and store all the functions in a list such that they are callable later?
This is what I have so far
index = -1
f_t = []
for f in inputs[:,0]:
index = index +1
def F_analytic(k, m, c):
F_t = k*m*c*f
return F_t
f_t.append([])
f_t[index].append(F_analytic)
but what I get in turn is a list of functions which are not callable:
Out[58]:
[[<function __main__.F_analytic>],
[<function __main__.F_analytic>],
[<function __main__.F_analytic>],
[<function __main__.F_analytic>],
[<function __main__.F_analytic>],
...
...
[<function __main__.F_analytic>],
[<function __main__.F_analytic>],
[<function __main__.F_analytic>]]
and the error is:
TypeError: 'list' object is not callable
Any help? Thank you!