MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Pattern Matching for Exponentials

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67505] Re: [mg67502] Pattern Matching for Exponentials
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 29 Jun 2006 00:09:02 -0400 (EDT)
  • References: <200606280752.DAA03521@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com


On 28 Jun 2006, at 16:52, 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.
>
> Thanks,
>
> Rick Eller
>

First of all, in Mathematica Sqrt[-1] can be input as I (capital  
letter) or as \[ImaginaryI] but never as i. As for your question, you  
should look at the FullForm of the expression you are trying to match  
and the FullForm of the pattern you are using and you will see why  
there is no Match. Here are a couple of possible solutions:


Unevaluated[Exp[2*I*t]] /. HoldPattern[Exp[(n_)*I*t]] ->
    Exp[n*I*t]/(n^2 - 1)


(1/3)*E^(2*I*t)



Exp[2*I*t] /. HoldPattern[E^((Complex[0, n_])*t)] ->
    Exp[n*I*t]/(n^2 - 1)


(1/3)*E^(2*I*t)

Andrzej Kozlowski
Tokyo, Japan



  • Prev by Date: Bugs--Bugs Report in List Operation
  • Next by Date: Re: Pattern Matching for Exponentials
  • Previous by thread: Pattern Matching for Exponentials
  • Next by thread: Re: Pattern Matching for Exponentials