Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Why does this pattern fail to match?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114253] Re: Why does this pattern fail to match?
  • From: kj <no.email at please.post>
  • Date: Sun, 28 Nov 2010 06:56:46 -0500 (EST)
  • References: <iclfej$lb7$1@smc.vnet.net> <ico230$ng8$1@smc.vnet.net>

On Nov 25, 11:57 am, kj <no.em... at please.post> wrote:
>> I'm tearing my hair out over this one.  Could someone please explain
>> to me why all the following MatchQ expressions
>>
>> MatchQ[Times[ -1, Power[s, -1]      ],
>>        Times[___, Power[___],    ___]]
>>
>> MatchQ[Times[ -1, Power[s, -1]],
>>        Times[___, Power[___]  ]]
>>
>> MatchQ[Times[ -1,  Power[s, -1]      ],
>>        Times[___, _Power        , ___]]
>>
>> return False?  (In all cases, s is undefined).  And yet, this succeed=
>s:
>>
>> MatchQ[Times[ -1,  Power[s, -1]],
>>        Times[___, _Power       ]]
>>
>> Is there a systematic way to debug/troubleshoot such pattern matching
>> problems? Trace is useless here.

Thanks for all your replies.  Trace is indeed useful here, contrary
to what I wrote (it was only the boneheaded way I was using Trace
that was useless).

~kj


  • Prev by Date: how to recover a corrupted notebook?
  • Next by Date: Re: How do I take every 3rd number from a text file?
  • Previous by thread: Re: Why does this pattern fail to match?
  • Next by thread: Re: Why does this pattern fail to match?