MathGroup Archive 1999

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

Search the Archive

Re: Finding real part (newbie question)


There is more than one way to do this.  The one which I use follows.  It
is not pretty.
The problem is how to tell Mathematica that a,b,c,d are real.  I assume
this is what you
meant.


(* Load the package *)
<<Algebra`ReIm`

(* The following "^=" are called Upsets and they *) (* tell the
operations Re,Im what to do when the symbols are encountered *)
Re[a]^=a;Im[a]^=0;
Re[b]^=b;Im[b]^=0;
Re[c]^=c;Im[c]^=0;
Re[d]^=d;Im[d]^=0;

(* Now for your problem *)
exp=1/(a + I b + 1/(c + I d))
Re[exp]//Simplify

(* to get a better feeling about this, try the following two *)

Re[a+I b]
a

Re[x + I y]
-Im[y]+Re[x]

The difference is that Mathematica doesn't know that x and y are real -
and maybe they aren't.

Kevin

-----Original Message-----
From: Gnalle <GNALLE at MMF.ruc.dk>
To: mathgroup at smc.vnet.net
Subject: [mg15760] [mg15722] Finding real part (newbie question)


>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/'
>
>



  • Prev by Date: Re: Surfacecoloring of a sphere
  • Next by Date: Re: Surfacecoloring of a sphere
  • Previous by thread: Re: Finding real part (newbie question)
  • Next by thread: Re: Finding real part (newbie question)