1
$\begingroup$

I have a very long and convoluted expression with many variables and my goal is to get just the terms which are coefficients of $e^{it}$. The variable $t$ never appears outside of exponential terms (only as $e^{ikt}$ for $k\in\mathbb{Z}$), so when I multiply through by $e^{-it}$, the terms I'm looking for are independent of $t$, while every other term has some $t$ dependence in it.

Is there a way to return only the terms which are independent of $t$ (while being dependent on some other variables)?

$\endgroup$

3 Answers 3

3
$\begingroup$

Coefficient would work in this case.

expr = E^(I Range[5] t). RandomInteger[{1, 10}, {5, 1}] // First

2 E^(I t) + 6 E^(2 I t) + 5 E^(3 I t) + 10 E^(4 I t) + E^(5 I t)

then

Coefficient[expr, E^( I t)]

2

$\endgroup$
3
$\begingroup$

This related question gives an answer to my own. The first comment suggests:

Select[expr,FreeQ[t]]

This returns the expression given but removes all terms which are dependent on the variable $t$.

$\endgroup$
3
$\begingroup$

You could try using FourierCoefficient. For example:

expr = x Exp[I t] + 2 y + 3 z Exp[-I t];
FourierCoefficient[expr, t, 1]

x

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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