- To: mathgroup at smc.vnet.net
- Subject: [mg8590] Re: [mg8542] MatchQ
- From: David Withoff <withoff>
- Date: Sun, 7 Sep 1997 22:13:09 -0400
- Sender: owner-wri-mathgroup at wolfram.com
> Can anybody explain me why
> MatchQ[E^(a*I*b), E^(I*freq_)] gives False ???
> (while for instance MatchQ[E^(a*I*b), E^(a*freq_)] gives True)
> What patterns should be used for expressions with I ?
> Many thanks,
> Raya Khanin
Are you sure that this is the example that you tried? This
returned True when I tried it.
In:= MatchQ[E^(a*I*b), E^(I*freq_)]
In general, probably the best way of answering questions involving
patterns is to compare the FullForm of the expression that you want
to match with the FullForm of the pattern. For example
Out//FullForm= Power[E, Times[Complex[0, 1], a, b]]
shows what Mathematica sees when it compares this expression
with a pattern. The pattern
In:= FullForm[ E^(I*freq_)]
Out//FullForm= Power[E, Times[Complex[0, 1], Pattern[freq, Blank]]]
should match this expression.
As a counterexample, here is a match that returns False
In:= MatchQ[E^(2 I b), E^(I freq_)]
for reasons that can be seen by looking at the FullForm of the expression
In:= E^(2 I b) //FullForm
Out//FullForm= Power[E, Times[Complex[0, 2], b]]
The match fails because Complex[0, 2] doesn't match Complex[0, 1].
Prev by Date:
Re: MeijerG special function
Next by Date:
Previous by thread:
Next by thread: