Re: trig expansion
- To: mathgroup at smc.vnet.net
- Subject: [mg8911] Re: [mg8854] trig expansion
- From: Daniel Lichtblau <danl>
- Date: Thu, 2 Oct 1997 22:57:04 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Murray Eisenberg wrote: > > How can I cause Mathematica to expand Sin[2 Pi omega t + 2 Pi delta], > where delta and omega are symbols, into the form > > Cos[2 Pi delta] Sin[2 Pi omega t] + Sin[2 Pi delta] Cos[2 Pi omega t] > > without using a replacment rule > > Sin[a_ + b_] -> Sin[a]Cos[b] + Cos[a]Sin[b] > > explicitly? (No TrigExpand does NOT do the trick -- it expands all > the way down to trig functions of Pi delta and Pi t omega!) > > -- > Murray Eisenberg Internet: murray at math.umass.edu > Mathematics & Statistics Dept. Voice: 413-545-2859 (W) > University of Massachusetts 413-549-1020 (H) > Amherst, MA 01003 Fax: 413-545-1801 One method is to temporarily replace integer coefficients (or to replace them temporarily, if you prefer not to split an infinitive). A quick-and-dirty approach is below. In[34]:= ee = Sin[2 Pi omega t + 2 Pi delta]; In[35]:= rule1 = a_Integer :> int[a]; In[36]:= rule2 = int[a] :> a; In[37]:= (TrigExpand[ee /. rule1]) /. rule2 Out[37]= Cos[omega Pi t int[2]] Sin[delta Pi int[2]] + > Cos[delta Pi int[2]] Sin[omega Pi t int[2]] More generally you may want to handle rational and Gaussian coefficients, as these are the multipliers of interest to TrigExpand. Daniel Lichtblau Wolfram Research danl at wolfram.com