I would like to compute coefficient in mathematica. for example I wrote this code to find the coefficients of cos(kx) in (a+b*cos(x))^4 where "a" and "b" are parameters.
f[x_] := (a + b Cos[x])^4
f1[x_] := TrigReduce[f[x]]
g[x_, k_] := Coefficient[f1[x], Cos[k x]]
it works for the coefficients of cos(k*x),
for example the coefficient of cos(2x) is
g[x,2]= 1/8 (24 a^2 b^2 + 4 b^4)
but it does not work for constant(here constant means independent of cos(kx). In other words, just the terms with numbers and the parameters "a" and "b").
I would like to write the code to find the constant in the above meaning.
thanks.