Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*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 2002

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

Search the Archive

Re: Why doesn't this rule work?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32470] Re: Why doesn't this rule work?
  • From: atelesforos at hotmail.com (Orestis Vantzos)
  • Date: Tue, 22 Jan 2002 03:19:52 -0500 (EST)
  • References: <a2ghu1$ki$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The correct rule is 
Plus[n1_. a, n2_. c, R___] /; n1 == -n2 :> Plus[R]
Repeat after me: FullForm is my best friend, FullForm is my best
friend,...
Indeed FullForm[a-b-c] for instance returns
Plus[a,Times[-1,b],Times[-1,c]]
It is evident that a rule of the form (n1_. a + n2_. b) simply does
not match, since the only _Plus expression present contains many more
things than a and c.
Hope that helped,
Orestis


  • Prev by Date: confusion with triple integral...
  • Next by Date: Re: Translations
  • Previous by thread: Why doesn't this rule work?
  • Next by thread: Re: Why doesn't this rule work?