       Re: Collecting like terms after TrigReduce

• To: mathgroup at smc.vnet.net
• Subject: [mg108967] Re: Collecting like terms after TrigReduce
• From: "Carl K. Woll" <carlw at wolfram.com>
• Date: Thu, 8 Apr 2010 08:03:35 -0400 (EDT)

```Try Collect:

Collect[a1 + a2 + c1 Cos[wt] + c3 Cos[wt] + c4 Cos[wt] +
c2 Cos[2 wt] + c4 Cos[2 wt] + s2 Sin[wt] + s1 Sin[2 wt] +
s3 Sin[2 wt], _Sin | _Cos]

Carl Woll
Wolfram Research

On 4/7/2010 3:19 AM, Geico Caveman wrote:
> I have a large expression that is expressed (after TrigReduce) as a
> series of the form:
>
> c1*cos(wt) + s1*sin(2wt) + a1+c2*cos(2 wt) + c3* cos(wt) + s2*sin(wt) +
> c4*cos(wt) + a2+c4*cos(2wt) + s3 sin(2wt)
>
> (This is just an illustrative example. The precise number of terms is
> larger and the number of each kind, impossible to know ahead of the
> calculation.)
>
> Is there any way (for compactness reasons alone) to force Mathematica
> to put this in a standard form:
>
> (a1+a2) + (c1+c3) cos(wt) + (c2 + c4)cos (2wt) + s2 sin(wt) + (s1+s3)
> sin(2wt) ?
>
> Using Simplify is not an option since that gets rid of the higher
> harmonic terms (which I want).
>
>

```

• Prev by Date: Branching on error messages?
• Next by Date: Re: Pattern to match a list of non-negative integers
• Previous by thread: Re: Collecting like terms after TrigReduce