MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Help! Sin[n Pi] (n Integer)

  • To: mathgroup at
  • Subject: [mg9015] RE: [mg8942] Help! Sin[n Pi] (n Integer)
  • From: Ersek_Ted%PAX1A at
  • Date: Wed, 8 Oct 1997 00:05:12 -0400
  • Sender: owner-wri-mathgroup at

Greg Anderson wrote:
|Does anyone know if there's a way to specify that a variable is an
| Sin[n Pi] or Cos[(2n+1)/2 Pi] come
|  up constantly.  I can dispose of them with replacement rules, but I was
|  wondering if there's a way to "tag" n as an integer so that Mma will
|  automatically kill the Sin and Cos terms later in the derivations.
The following will do what you want:

In[1]:=  Unprotect[Sin, Cos];
              Sin[n_?IntegerQ * Pi]:=0
              Cos[n_?OddQ/2 * Pi]:=0
              Cos[(m_?EvenQ * n_?IntegerQ + 1)/2  Pi]:=0
              Protect[Sin, Cos];

In[4]:= IntegerQ[n]^=True;

In[5]:=  {Sin[n Pi], Cos[(2 n + 1)/2 Pi], Cos[ j / 2 * Pi], Cos[a /2 * Pi]}
Out[5]=  { 0, 0, 0, Cos[a Pi/2] }

Notice:  Cos[a/2 * Pi]  doesn't simplify because nothing is known about (a).
I hope WRI will include the rules above and hundreds of other in a later 

     Ted Ersek
     ersek_ted%pax1a at

  • Prev by Date: Vertical plot labels
  • Next by Date: Re: TraceInternal and OptionQ
  • Previous by thread: Re: Help! Sin[n Pi] (n Integer)
  • Next by thread: Re: Re: Help! Sin[n Pi] (n Integer)