Suppose I have an expression of the this type:
Quantity["Epsilonzero"] a (b + c Sin[ω t])^2
where t is time. I am interested in "extracting" the non time-dipendent part. I can expand the expression to show the time dependent terms:
Expand[%]
mysum = TrigReduce[%]
and obtain for mysum
a c^2 Cos[2 t ω] (Quantity[-(1/2), "ElectricConstant"]) +
a b c Cos[t ω] (Quantity[-I, "ElectricConstant"]) +
a b c Cos[t ω] (Quantity[I, "ElectricConstant"]) +
a c^2 (Quantity[1/2, "ElectricConstant"]) +
a b^2 (Quantity[1, "ElectricConstant"]) +
a b c (Quantity[2, "ElectricConstant"]) Sin[t ω] +
a c^2 (Quantity[-(I/4), "ElectricConstant"]) Sin[2 t ω] +
a c^2 (Quantity[I/4, "ElectricConstant"]) Sin[2 t ω]
Now I want only the terms that do not contain any dependence on t. I could do:
mysum /. {Cos[t ω] -> 0, Cos[2 t ω] -> 0, Sin[t ω] -> 0, Sin[2 t ω] -> 0}
But because of the presence of Quantity[1, "ElectricConstant"], I get:
b c (Quantity[0, "ElectricConstant"]) +
a c^2 (Quantity[0, "ElectricConstant"]) +
a c^2 (Quantity[1/2, "ElectricConstant"]) +
a b^2 (Quantity[1, "ElectricConstant"])
i.e., the terms that are effectively 0 are not dropped.
I could also do:
Collect[mysum, {Cos[t ω], Cos[2 t ω], Sin[t ω], Sin[2 t ω]}]
and then just pick out the terms of the sum that do not contain the unwanted terms. However, the order in which these terms appear is dependent on the exact form of the original expression, so I'd have to adjust them on a case-by-case basis.
Any other idea? The only thing I came out with so far (and it's not too bad) is to replace Quantity["Epsilonzero"] in the original expression with a normal symbol (not a Quantity), and only put the quantity back in place later.