Author 
Comment/Response 
Bill Simpson

05/21/12 00:41am
In Response To 'Re: Re: making a transformation'  You wrote:
"Hi Bill,
Another example that puzzles me. See attachment.
Attachment: Simpson transformation example.nb"
(* This one doesn't work *)
FullSimplify[(ab*i)*E^((pi*q)*t) + (a+b*i)*E^((p+i*q)*t)]/. a_ Cos[c_]b_ Sin[c_]>Sqrt[a^2+b^2]Cos[c+ArcTan[a,b]]
(**because because there is no a*Cos[c]b*Sin[c] to match**)
and then at the bottom of your notebook
(* but this one doesn't *)
(**again because there is no a*Cos[c]b*Sin[c] to match**)
Perhaps this will help, think of all pattern matching in Mathematica like this: "IF AND ONLY IF you give me an expression that looks almost EXACTLY like THIS then I will substitute THAT and give it back, otherwise I will give you back your original with no changes at all."
Mathematica does not do "mathematical pattern matching"=understanding the intent of the expression and the pattern. Instead Mathematica does "structureal pattern matching"=if the structure of the expression and the pattern are almost identical then it will work and not otherwise.
Mathematica will almost never look at your expression, realize that it could do a bunch of rearrangement, make a bunch of algebraic changes, then see that there is a way your pattern could match and give you the substitution.
If you need Mathematica to make a brilliant substitution for an expression that isn't almost exactly in the form your simple pattern is in and you need that pattern to work for all kinds of small variations in your expression then you need to be able to write brilliant complicated pattern that will do all that work for you. And the beginning to intermediate Mathematica user doesn't have the skill or knowledge to be able to do that.
For your examples that work and the ones that don't, look at the result from FullSimplify, using FullForm if necessary, and try to see the structures are identical when the substitution works and not identical when it fails.
URL: , 
