Re: Finding real part (newbie question)
- To: mathgroup at smc.vnet.net
- Subject: [mg15787] Re: Finding real part (newbie question)
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 7 Feb 1999 02:04:04 -0500 (EST)
- References: <79e8lo$9du@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Gnalle wrote in message <79e8lo$9du at smc.vnet.net>... >If a,b,c,d are real numbers. How do I use mathematica to find the real >part of > >1/(a + I b + 1/(c + I d)) > >Yes I can calculate it by hand, but I would like to know how to use >Mathematica. >-- > > Niels Langager Ellegaard > 'http://mmf.ruc.dk/~gnalle/' > Niels: In[1]:= ComplexExpand[Re[1/(a + I b + 1/(c + I d))], TargetFunctions->{Re,Im}] Out[1]= a/((a + c/(c^2 + d^2))^2 + (b - d/(c^2 + d^2))^2) + c/((c^2 + d^2)*((a + c/(c^2 + d^2))^2 + (b - d/(c^2 + d^2))^2)) If you will need to do this a lot in the session you can set the option TargetFunctions once and for all with In[2]:= SetOptions[ComplexExpand , TargetFunctions->{Re,Im}]; Then In[3]:= ComplexExpand[Re[1/(a + I b + 1/(c + I d))]] Out[3]= a/((a + c/(c^2 + d^2))^2 + (b - d/(c^2 + d^2))^2) + c/((c^2 + d^2)*((a + c/(c^2 + d^2))^2 + (b - d/(c^2 + d^2))^2)) In[4]:= ComplexExpand[Re[Log[Sin[x+I y]]]] Out[4]= 1/2*Log[Cosh[y]^2*Sin[x]^2 + Cos[x]^2*Sinh[y]^2] Allan --------------------- Allan Hayes Mathematica Training and Consulting www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565