I am trying to write the simplest (and efficient) pattern that matches the linear combination of all functions except when the combination produces zero?
Consider the following as an example:
pattern=HoldPattern[Except[0,(_:1)*Optional[Fibonacci[_],0]+(_:1)*Optional[LucasL[_],0]]];
Now if I use this to match the following cases:
MatchQ[pattern]/@{
0,
2 LucasL[n],
Fibonacci[n],
-(Fibonacci[n]/2)+LucasL[n]/2
}
I want the pattern to produce true for the last three, i.e. {False, True, True, True}
.
How do I fix this pattern
?