0
$\begingroup$

Consider an expansion

$$\eta = a\cos (kx-\omega t) +\frac{1}{2} a^2 k \cos 2 (kx-\omega t).$$

I would like to compute expansions like

$$ V = \frac{1}{2\pi} \int _0^{2\pi} \eta^2 \ d\theta ,$$

with $\theta = kx-\omega t$ and then find all nonzero terms of this. The simplest way for me to do this, instead of integrating the above, is to use TrigExpand, and then collect all of the terms and see which terms belong to trigonometric basis 1. However, when I do this for complicated cases, it becomes a burden to do this by eye. I'd like to set all terms that still depend on a trig function to zero.

Here's a sample code that illustrates my problem.

\[Eta][x_, t_] := 
1/2 ((I*k/\[Omega]*A)*
  Exp[I*(k*x - \[Omega]*t)] + (1/2*I*(k/\[Omega])^2*k*A^2)*
  Exp[2*I*(k*x - \[Omega]*t)] + (-I*k/\[Omega]*Ap)*
  Exp[-I*(k*x - \[Omega]*t)] + 
 1/2*I*(k/\[Omega])^2*k*Ap^2*Exp[-2*I*(k*x - \[Omega]*t)]);

Using

TrigExpand[1/2*\[Eta][x, t]^2]

I find $$-\frac{A^2 \text{Ap}^2 k^6}{16 \omega ^4}-\frac{\text{Ap}^4 e^{-4 i (k x-t \omega )} k^6}{32 \omega ^4}-\frac{A^4 e^{4 i (k x-t \omega )} k^6}{32 \omega ^4}-\frac{A \text{Ap}^2 e^{-i (k x-t \omega )} k^4}{8 \omega ^3}+\frac{A^2 \text{Ap} e^{i (k x-t \omega )} k^4}{8 \omega ^3}+\frac{\text{Ap}^3 e^{-3 i (k x-t \omega )} k^4}{8 \omega ^3}-\frac{A^3 e^{3 i (k x-t \omega )} k^4}{8 \omega ^3}+\frac{A \text{Ap} k^2}{4 \omega ^2}-\frac{\text{Ap}^2 e^{-2 i (k x-t \omega )} k^2}{8 \omega ^2}-\frac{A^2 e^{2 i (k x-t \omega )} k^2}{8 \omega ^2}$$

Out of the 10 terms, only 2 are non-zero. In general I don't want to use an operation like integration, as $a$ will have a weak dependence on (x,t) that is crucial for deriving $\eta$, but can be ignored in the integration. Is there any other way to send these terms to 0?

$\endgroup$
1
  • $\begingroup$ Why don't just subtract them? $\endgroup$ – Dr. belisarius Jul 16 '15 at 4:32
2
$\begingroup$

Why not

TrigExpand[1/2*\[Eta][x, t]^2] /. Exp[_]->0

which gives

-((A^2 Ap^2 k^6)/(16 ω^4)) + (A Ap k^2)/(4 ω^2)
$\endgroup$
1
  • $\begingroup$ Great, thanks @Bill $\endgroup$ – Nick P Jul 16 '15 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.