Re: Pattern Matching for Exponentials
- To: mathgroup at smc.vnet.net
- Subject: [mg67516] Re: Pattern Matching for Exponentials
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Thu, 29 Jun 2006 00:09:37 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 6/28/06 at 3:52 AM, reller at bigpond.com (Rick Eller) wrote: >I am looking for a pattern-matching replacement rule which will >transform exponential functions of the form exp(n i t) into >(1/(n^2-1))exp(n i t) where i = sqrt[-1]. For example, exp(2 i t) >should convert to (1/3)exp(2 i t). I've tried the following code >without success : >In: Exp[2 i t] /. Exp[n_ i t] -> Exp[n i t]/(n^2-1) >Out: e^2 i t >I would appreciate any suggestions as to how this code should be >modified. The problem is that In[11]:= MatchQ[2 I t, a_ I t] Out[11]= False In[12]:= MatchQ[2 I t, a_ t] Out[12]= True So, you need In[13]:= Exp[2 I t]/.Exp[a_ t]->Exp[a t]/(Im[a]^2-1) Out[13]= (1/3)*E^(2*I*t) but note if instead of Exp[2 I t] you had Exp[b I t] then In[15]:= Exp[b I t]/.Exp[a_ I t]->Exp[a I t]/(a^2-1) Out[15]= E^(I*b*t)/(b^2 - 1) works fine -- To reply via email subtract one hundred and four