Re: Extract coefficients of a trig polynomial
- To: mathgroup at smc.vnet.net
- Subject: [mg126124] Re: Extract coefficients of a trig polynomial
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Fri, 20 Apr 2012 07:42:11 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201204190754.DAA04272@smc.vnet.net>
coef = Module[{x}, Simplify[CoefficientList[ expr /. Cos[n_. * \[Theta]] -> x^n, x]]] Bob Hanlon 2012/4/19 Sam Takoy <sam.takoy at yahoo.com>: > Hi, > > Suppose I have an expression that is a trigonometric polynomial in > theta. Is there a way to neatly pick out the coefficients of the > polynomial. I find that FourierCoefficient takes quite a bit of time, > probably because it does a lot of integrations. My coefficients are > very complicated expressions but do not depend on theta. > > Many thanks in advance, > > Sam > > PS: expr = (1/1536)(1536 BesselJ[0,\[Rho]]-72 \[Epsilon]^2 \[Rho]^2 > BesselJ[0,\[Rho]]-80 \[Epsilon]^3 \[Rho]^2 BesselJ[0,\[Rho]]-384 \ > [Epsilon] \[Rho] BesselJ[1,\[Rho]]-144 \[Epsilon]^2 \[Rho] BesselJ[1,\ > [Rho]]-80 \[Epsilon]^3 \[Rho] BesselJ[1,\[Rho]]+10 \[Epsilon]^3 \ > [Rho]^3 BesselJ[1,\[Rho]]-96 \[Epsilon]^2 \[Rho]^2 BesselJ[0,\[Rho]] > Cos[2 \[Theta]]-120 \[Epsilon]^3 \[Rho]^2 BesselJ[0,\[Rho]] Cos[2 \ > [Theta]]-384 \[Epsilon] \[Rho] BesselJ[1,\[Rho]] Cos[2 \[Theta]]-192 \ > [Epsilon]^2 \[Rho] BesselJ[1,\[Rho]] Cos[2 \[Theta]]-120 \[Epsilon]^3 \ > [Rho] BesselJ[1,\[Rho]] Cos[2 \[Theta]]+15 \[Epsilon]^3 \[Rho]^3 > BesselJ[1,\[Rho]] Cos[2 \[Theta]]-24 \[Epsilon]^2 \[Rho]^2 BesselJ[0,\ > [Rho]] Cos[4 \[Theta]]-48 \[Epsilon]^3 \[Rho]^2 BesselJ[0,\[Rho]] > Cos[4 \[Theta]]-48 \[Epsilon]^2 \[Rho] BesselJ[1,\[Rho]] Cos[4 \ > [Theta]]-48 \[Epsilon]^3 \[Rho] BesselJ[1,\[Rho]] Cos[4 \[Theta]]+6 \ > [Epsilon]^3 \[Rho]^3 BesselJ[1,\[Rho]] Cos[4 \[Theta]]-8 \[Epsilon]^3 \ > [Rho]^2 BesselJ[0,\[Rho]] Cos[6 \[Theta]]-8 \[Epsilon]^3 \[Rho] > BesselJ[1,\[Rho]] Cos[6 \[Theta]]+\[Epsilon]^3 \[Rho]^3 BesselJ[1,\ > [Rho]] Cos[6 \[Theta]]) >
- References:
- Extract coefficients of a trig polynomial
- From: Sam Takoy <sam.takoy@yahoo.com>
- Extract coefficients of a trig polynomial