Question: projecting functions

This a sample program that I wrote which is supposed to test a function that I wrote "proj" to project a function onto a basis.  In particular, in this example I use a Fourier mode.  When I project a function which is a sum of two terms I get an incorrect answer.  When I project each term I get the correct answer.

Any ideas why this yielding an inconsistent result?  Also, if maple has it's own version of proj that is more stable I'm happy to use that.

> restart;
> proj := proc (a, b) options operator, arrow; (int(int(a*conjugate(b), x = 0 .. 2*Pi), t = 0 .. 2*Pi))/(int(int(b*conjugate(b), x = 0 .. 2*Pi), t = 0 .. 2*Pi)) end proc;
> assume(x, real, t, real, k, integer, omega, integer);
> eta := unapply(B(T)*exp(I*(k*x-omega*t))+conjugate(B(T))/exp(I*(k*x-omega*t)), x, t, T);
print(`output redirected...`); # input placeholder
                                                    ____        
                                                    B(T)        
(x, t, T) -> B(T) exp(I (k x - omega t)) + ----------------------
                                           exp(I (k x - omega t))
This like projects the function onto a particular Fourier basis and the answer yields zero even though the correct answer is B(T).
> proj(eta(x, t, T), exp(I*(k*x-omega*t)));
print(`output redirected...`); # input placeholder
                                      0
If I project on the first half of the function then I get the correct answer of B(T)
> proj(B(T)*exp(I*(k*x-omega*t)), exp(I*(k*x-omega*t)));
print(`output redirected...`); # input placeholder
                                    B(T)
If I project on the second half I get the correct answer of 0
> proj(conjugate(B(T))/exp(I*(k*x-omega*t)), exp(I*(k*x-omega*t)));
print(`output redirected...`); # input placeholder
                                      0
Why is it that Maple will not correctly project the sum of the two terms even though it does each term correctly?
 

Please Wait...