Re: how to specify something is "real"
- To: mathgroup at smc.vnet.net
- Subject: [mg43198] Re: how to specify something is "real"
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Mon, 18 Aug 2003 02:50:57 -0400 (EDT)
- Organization: The University of Western Australia
- References: <bhi5j3$hne$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bhi5j3$hne$1 at smc.vnet.net>, "pgp" <bla at bla.com> wrote: > This is probably a dumb question, but I was trying to use Conjugate[] on an > expression that contains terms like Cos[x], and mathematica doesn't take it > for granted that Cos[x] is real, and hence the end result contain lots of > Conjugate's that can't be reduced. > Could someone tell me if it's possible to tell mathematica which parts of > the expressions are supposed to be real, so it'll get rid of all those > Conjugates? Other respondents have mentioned the use of ComplexExpand to do what you want. However, if your expressions have explicit complex variables then it is often easier (and faster) to use pattern-matching to compute the Conjugate. For example, Exp[x + I y] /. Complex[a_, b_] :> Complex[a, -b] This can be automated using SuperStar[x_] := x /. Complex[a_, b_] :> Complex[a, -b] so that expressions followed by a superscripted * are conjugated. Other standard notations include a superscripted dagger, SuperDagger[x_] := x /. Complex[a_, b_] :> Complex[a, -b] or an over bar OverBar[x_] := x /. Complex[a_, b_] :> Complex[a, -b] so you can use whichever one you prefer. Cheers, Paul -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul