When I input this:
MatchQ[x*SF[a,b] + y*SF[c,d], Plus[Times[x,SF[a,b]],Times[y,SF[c,d]]]]
I get "True" as expected. But If I change it to:
MatchQ[x*SF[a,b] + y*SF[c,d], Plus[Times[_,SF[_,_]],Times[_,SF[_,_]]]]
Which ought to be more general, it returns false.
Why does this happen? I think it's evaluate the Plus, and return a pattern like Times[2,,SF[,_]]. But how do I make it stop doing that?
My goal is to Match the pattern for expressions like x*SF[a,b] + y*SF[c,d] + z*SF[e,f] ... So what do I have to do to fix this?
Comments
Post a Comment