Problems with named patterns
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1107] Problems with named patterns
- From: steve at tweedledee.ucsb.edu (Steve Trainoff)
- Date: Sun, 14 May 1995 23:51:40 -0400
- Organization: University of California, Santa Barbara
I am having a problem naming patterns using the syntax "x:pattern". Here is a contrived example. Mathematica 2.0 for NeXT Copyright 1988-91 Wolfram Research, Inc. (* Without an name this matches *) In[1]:= a Cos[2 x] Cos[3 x] /. (Cos[n_. x_] Cos[m_. x_]) -> junk Out[1]= a junk (* With a name, but without a leading constant, this matches *) In[2]:= Cos[2 x] Cos[3 x] /. q:(Cos[n_. x_] Cos[m_. x_]) -> junk Out[2]= junk (* With a name and a leading constant, this FAILS *) In[3]:= a Cos[2 x] Cos[3 x] /. q:(Cos[n_. x_] Cos[m_. x_]) -> junk Out[3]= a Cos[2 x] Cos[3 x] What is going on here? -- ..STeve ------------------------------------ Insert pithy maxim here... steve at tweedledee.ucsb.edu (NeXT mail)