Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

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)


  • Prev by Date: Fouriering sound data
  • Next by Date: Re: finding irregular areas
  • Previous by thread: Fouriering sound data
  • Next by thread: Q:Hidden lines as dashed?