Your original problem arises due to the fact that you don't call the function you define. You cannot expect a function to know what arguments it must work with. Python is procedural; you must pass those arguments yourself.
Alternatively (and I recommend this), you could just use numpy's ufuncs and vectorise everything:
y_array = A * (np.exp(-gamma) ** (t_array)) * np.cos((np.sqrt(k / m)) * (t_array))
print(y_array)
array([ 0.3 , 0.26197643, 0.20012117, 0.12471753, 0.04610095,
-0.02650152, -0.08584334, -0.12718585, -0.14847109, -0.1501709 ,
-0.13487525, -0.10670268, -0.07062388, -0.03178614, 0.00508595,
0.03615761, 0.05878548, 0.07164338, 0.07468336, 0.06895966,
0.05635461, 0.03925115, 0.0201959 , 0.00159182, -0.01454951,
-0.02677677, -0.03428127, -0.03689604, -0.0350233 , -0.02950888,
-0.02148485, -0.01220259, -0.00287629, 0.0054473 , 0.01198185,
0.0162522 , 0.01810327, 0.0176719 , 0.01533013, 0.01161037,
0.00712318, 0.00247811, -0.00178419, -0.00524252, -0.00762514,
-0.00881889, -0.00885931, -0.00790559, -0.00620522, -0.00405386]
Disclaimer: I cannot verify this answer because you have not explained what you are trying to do. This should hopefully get you started in the right direction working with vectorisation.
yis indeed the function, fromdef y(...):. You need to call your function, and the function needs to return the resulting list.print(y(t_array))?f(x) = x^2but you don't actually get out values unless you put them into the function, likef(2).print(y).yis a function, and you're printing it without calling it. To call it, you need to add parentheses (and in this case, pass an argument), likeprint(y(t_array))for instance.