Question: Coefficients extraction to form Equations

N := 4;
print(`output redirected...`); # input placeholder
y := sum(A[2*n].cos(2.*n.x), n = 0 .. N);

eq1 := diff(y, `$`(x, 2))+(a+2*q*cos(2*x))*y

eq2 := map(combine, eq1, trig)

for i from 0 to 4 do eq4[i] := coeff(eq2, cos(2*n*x)) end do

From these I want to extract the co-ffficients of cos(0x),cos(2x),cos(4x)..

and form a simultaneous linear equation containg A0,A2,A4

The solution is 



Can anybody tell me how to do it

Please Wait...