coefficient in trigonometrics sums in Mathematica -


i compute coefficient in mathematica. example wrote code find coefficients of cos(kx) in (a+b*cos(x))^4 "a" , "b" parameters.

f[x_] := (a + b cos[x])^4  f1[x_] := trigreduce[f[x]]  g[x_, k_] := coefficient[f1[x], cos[k x]] 

it works coefficients of cos(k*x),

for example coefficient of cos(2x) is

g[x,2]= 1/8 (24 a^2 b^2 + 4 b^4) 

but not work constant(here constant means independent of cos(kx). in other words, terms numbers , parameters "a" , "b").

i write code find constant in above meaning.

thanks.

plugging coefficient[trigreduce[(a + b*cos[x])^4],cos[2*x]] wolfram|alpha produced output wanted to. leads me suggest problem might have how expression being evaluated opposed problem how mathematically thinking it.

i not have access copy of mathematica can not test this, try changing := = in second line of code.

i try putting in 1 line as

g[x_, k_] := coefficient[trigreduce[(a + b cos[x])^4], cos[k x]] 

if works, wrong how/when mathematica assigning stuff.

see this link more information.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -