RE: Pattern Matching for Exponentials
- To: mathgroup at smc.vnet.net
- Subject: [mg67524] RE: [mg67502] Pattern Matching for Exponentials
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 29 Jun 2006 00:10:13 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Rick, If you examine the FullForm of the expression and the pattern, you will see that they do not match. (I'm using the actual Mathematica I for Sqrt[-1].) Exp[2 I t] // FullForm Power[E, Times[Complex[0, 2], t]] Exp[n_ I t] // FullForm Power[E, Times[Complex[0, 1], t, Pattern[n, Blank[]]]] The following rule will match. Exp[2 I t] /. Exp[Complex[0, n_] t] :> Exp[n I t]/(n^2 - 1) (1/3)*E^(2*I*t) David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Rick Eller [mailto:reller at bigpond.com] To: mathgroup at smc.vnet.net 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