MathGroup Archive 2003

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

Search the Archive

negative pattern matching anyone?

  • To: mathgroup at
  • Subject: [mg43702] negative pattern matching anyone?
  • From: Paolo Bientinesi <pauldj at>
  • Date: Tue, 30 Sep 2003 16:43:01 -0400 (EDT)
  • Organization: University of Texas at Austin
  • Sender: owner-wri-mathgroup at

could anyone explain me why -3 is different from -a in the
following situation, please?

h[-x_] := Abs[x]
h[x_]  := x^2


k[-3] = 9
k[-a] = Abs[a]

I guess the answer con be found in the FullForm:

FullForm[-a] = Times[-1,a]
FullForm[-x_] = Times[-1,Pattern[x,Blank[]]]

while FullForm[-3] = -3

Then, is there a way to match both -3 and -a with the same pattern?

pauldj at		        paolo.bientinesi at

  • Prev by Date: global Minimum
  • Next by Date: Polynomial constructing
  • Previous by thread: global Minimum
  • Next by thread: Polynomial constructing