Student Support Forum: 'making a transformation' topicStudent Support Forum > General > Archives > "making a transformation"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Bill Simpson 05/26/12 10:14pm In Response To 'Re: Re: Re: Re: making a transformation'---------From your previous message. In[3]:= FullSimplify[2 Cos[1000 t]-4 Sin[1000 t]] Out[3]= 2 (Cos[1000 t]-2 Sin[1000 t]) (*Does that look EXACTLY like p*Cos[q]-r*Sin[q]? No. There is no p*Cos[q]. There is p*(Cos[q]...) and to the pattern matcher that is completely different. So the pattern match fails*) "The output I get for this is:2 (Cos[1000 t]-4 Sin[1000 t]) Clearly there is a match here,yet it doesn't do anything." If you are an algebra student who interprets 2(Cos[q]-4Sin[q]) to actually mean 2Cos[q]-8Sin[q] then it is clear. The pattern matcher is not an algebra student. If you are Mathematica then 2(Cos[q]-4Sin[q]) does not have p*Cos[q]-r*Sin[q]. As I have told you repeatedly, pattern matching has no mathematical sense and does not go around rearranging equations to see if it can get it into the form you want. Think of this like a word processor. If you search for p*Cos[q] and your document has p*(Cos[q]...) your text search is going to fail. Perhaps think of Mathematica's pattern matching that way and see if you realize how literal the pattern matching process is. That is it. I don't know many other ways to tell you the same thing again. Sorry. Look at the FullForm of the expression you are trying to match and if the "structure" is not identical then the pattern is not going to match. (Actually things are even a little more complicated than that, but that is deeper than I want to get into at the moment.) And now your next message you have exactly the same example again. In[1]:= A=2;B=4;w=1000; FullSimplify[A Cos[w t]-B Sin[w t]] Out[2]= 2 (Cos[1000 t]-2 Sin[1000 t]) (*Does that look EXACTLY like p*Cos[q]-r*Sin[q]? No. There is no p*Cos[q]. So the pattern match fails*) In[5]:= Clear[A,B,w] In[6]:= FullSimplify[A Cos[w t]-B Sin[w t]] Out[6]= A Cos[t w]-B Sin[t w] (*Does that look EXACTLY like p*Cos[q]-r*Sin[q]? Yes. So the pattern match succeeds*) There are times I dearly wish the pattern matcher was smarter. Perhaps 20 years ago someone wrote up an article in the Mathematica journal where he implemented a smarter pattern matcher. I do not believe anything was ever done to incorporate that into the last half dozen versions of Mathematica. I wouldn't mind having that available for the current version of Mathematica, but parts of that do not appear to be compatible and bringing that up to date is more than I could do. URL: ,

 Subject (listing for 'making a transformation') Author Date Posted making a transformation Ed Nowak 05/16/12 05:19am Re: making a transformation Bill Simpson 05/16/12 1:18pm Re: Re: making a transformation Ed Nowak 05/19/12 00:18am Re: Re: making a transformation Ed Nowak 05/19/12 02:14am Re: Re: Re: making a transformation Bill Simpson 05/21/12 00:41am Re: Re: Re: Re: making a transformation Ed Nowak 05/25/12 01:18am Re: Re: Re: Re: making a transformation Ed Nowak 05/25/12 02:23am Re: Re: Re: Re: Re: making a transformation Bill Simpson 05/26/12 10:14pm Re: Re: Re: Re: Re: Re: making a transformation Ed Nowak 05/28/12 7:22pm Re: Re: Re: Re: Re: making a transformation Michael 05/27/12 07:20am Re: making a transformation Ed Nowak 05/18/12 07:25am
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic