Message Boards Message Boards

0
|
26456 Views
|
6 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to separate real and imaginary parts of a large complex fraction?

Posted 11 years ago

I have a large complex fraction and I want to separate its real and imaginary parts. I have declared all my variables real in the beginning of the notebook and I am applying ComplexExpand[Re[frac]], notebook is running for weeks, yet no output. Please help me out. The notebook is attached.

thanking you.

Attachments:
POSTED BY: ver din
6 Replies
Posted 11 years ago

I believe part of the reason you are seeing what you see as Real is because of approximate (decimal) constants.

In[1]:= (0.+ 8.111989164074249^-126 I)Conjugate[(0.+ 8.111989164074249*^-126 I) ]

Out[1]= 6.58044*10^-251 + 0. I

In[2]:= (0 + 8 I)*Conjugate[(0 + 8 I) ]

Out[2]= 64

Mathematica interprets 0. as "approximately zero" and not known to many significant digits, while integers without decimals are exact.

But even replacing all 0. with 0 won't solve all the problems.

POSTED BY: Bill Simpson
Posted 11 years ago

I do not know how Denominator[1/p+q] will behave. I find this simple example

In[1]:= expr1 = 1/(a + I b) + c + I d;
Denominator[expr1]

Out[2]= 1

In[3]:= Numerator[expr1]

Out[3]= 1/(a + I b) + c + I d

In[4]:= {LeafCount[expr1],  LeafCount[expr1[[1]]] + LeafCount[expr1[[2]]],  
           LeafCount[Denominator[expr1]] + LeafCount[Numerator[expr1]]}

Out[4]= {168640, 168639, 167369}

The first total is 1 less than the leaves in expr1 because the Plus has been removed. The second total appears to be missing 1271 items so I am concerned about your multiplying and dividing by conjugate of denominator. I suppose it might be possible that the Numerator and Denominator are somehow rearranging the expressions to end up with fewer leaves, but I would verify that the results are correct before using them.

My apologies for making any error. If you can explain what I did incorrectly I would appreciate it.

I do not think Conjugate[Denominator[expr1]] * Numerator[expr1] should be real, but I had hoped that this would provide a rapid method of extracting the real and complex parts. I would verify your calculation on a smaller example to see if this is correct.

I do not know how to interpret your using Chop, everything I was doing was intending to be exact calculations.

POSTED BY: Bill Simpson
Posted 11 years ago

Please check this very carefully to ensure that I have made no mistakes.

(* expr1==Plus[1/p,q]==Conjugate[p]/(Re[p]^2+Im[p]^2)+q *)
p = 1/expr1[[1]];
q = expr1[[2]];
Rp = ComplexExpand[Re[p]];
Ip = ComplexExpand[Im[p]];
Rq = ComplexExpand[Re[q]];
Iq = ComplexExpand[Im[q]];
Rexpr1 = ComplexExpand[Re[Conjugate[p]]]/(Rp^2 + Ip^2) + Rq;
Iexpr1 = ComplexExpand[Im[Conjugate[p]]]/(Rp^2 + Ip^2) + Iq;

If I have made no mistakes then in 20 seconds you have your solution. Perhaps someone can think of a way to test this in 20 seconds.

POSTED BY: Bill Simpson
Posted 11 years ago
POSTED BY: ver din
POSTED BY: David Reiss
Posted 11 years ago

Thanks for the help. My goal is first to solve two parts (real and imaginary) for Rdot. Later I want to extract coefficient of theta (with specific exponent) from Rdot. Then I expect to get a relation between Rdot and theta in terms of another paramters followed by continuation method to investigate the trend among paramters.

POSTED BY: ver din
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract