Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.8K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Real and Imaginary parts of calculation swapped

Posted 9 years ago

I have a calculation that I'm having Mathematica do for me. It's quite complicated, involving many steps, matrices, eigenvectors, imaginary parts, all that. In the end I want to plot the results.

I also have an expression for the coefficients I want to plot from a paper. If I put this expression brute-force into Mathematica and compare the table of values with the equivalent part that Mathematica has calculated the real and imaginary parts are exactly swapped.

What is my most likely error here? Is there a known issue. Have I made a common typo? At one point I normalize some vectors, could that be contributing? The inner workings of Mathematica are a mystery to me.

POSTED BY: Eleanor Holmes
2 Replies
Posted 9 years ago

Thanks for your response,

This code is quite untidy because I was trying a lot of things to fix the problem. If you wish to tidy it up you can remove the graphs as they aren't really relevant at this point.

The key part is the vector Au1. Each of the four parts of Au1 should correspond directly to one of the equations I have entered brute force into mathematica. The correspondence is as follows:

Au1[[1]] = t3 [kx,l]

Au1[[2]] = t4 [kx,l]

Au1[[3]] = r1 [kx,l]

Au1[[4]] = r2 [kx,l]

As you can see from the tables of values for each Au1[[1]] is the only one that actually equals the values from t3 (to within machine error) For Au1[[2]] the values for real and imaginary parts are flipped below kx = 1. While for Au1[[3]] and Au1[[4]] there is both a flipping of real and imaginary parts AND a complete flipping of the values between the two equations below kx = 1. That is all of the values of Au1[[3]] for kx < 1 should be the values of Au1[[4]] for kx < 1.

For the purposes of this troubleshooting, I am assuming that the equations for t3, t4, r1, and r2 are completely correct. They give me the correct graphs in any case.

I really need the Mathematica calculated parts to be correct because I have to make this program more complicated and I won't always have equations I can take from literature.

Attachments:
POSTED BY: Eleanor Holmes

Imposible to answer your question, really, without actual code to examine. A minimal working example exhibiting the behavior would be best.

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