Troubleshooting Mathematica Eigen Problem: Analytical vs. Numerical Results"

  • Context: Mathematica 
  • Thread starter Thread starter guidob
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting issues encountered in Mathematica when calculating eigenvalues and eigenvectors of matrices, particularly focusing on discrepancies between analytical and numerical results as parameters change. The scope includes technical explanations and potential solutions related to numerical precision and mathematical formulation.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports that their numerical results align with analytical ones only for values of "t" below approximately 30, suggesting strange behavior for larger values.
  • Another participant advises against using many symbols in Mathematica and suggests absorbing exponential factors into constants to improve calculations.
  • A participant expresses gratitude for the advice received and mentions successfully implementing the suggested changes.
  • Another participant proposes that the underlying issue may stem from using approximate calculations with high precision, indicating that the problem could be "ill posed" and recommending a resource for reformulating such problems for better accuracy.

Areas of Agreement / Disagreement

Participants present various viewpoints on how to address the numerical issues, with no clear consensus on the best approach. Some suggest changes to the code and methodology, while others highlight potential pitfalls in numerical approximations.

Contextual Notes

Limitations include the dependence on numerical precision settings and the potential for errors in calculations when dealing with ill-posed problems. Specific assumptions about the behavior of the matrices and the parameters involved are not fully resolved.

guidob
Messages
4
Reaction score
0
Hi! I'm having some trouble with this. In the code I define two matrices, then calculate its eigenvalues/eigenvectors, and finally I plot the absolute values of the components of the eigenvectors. The results are consistent with (I'm quite sure) the analytical ones but only below "t approx 30". Above this value, (only) the first plot corresponding to one of the vectors shows some strange behaviour.

Any idea? I've tried to solve it changing the precision options, but I couldn't.

Thanks!
 

Attachments

Physics news on Phys.org
You should avoid to letting Mathematica works with lots of symbols. Just absorb exponential factor in constant b and redefine it later.

Code:
Clear[a,b,w,g,t]
ρt={{a,b},{b*,1-a}};
{e1,e2}=Eigenvalues[ρt]; 
{v1,v2}=Eigenvectors[ρt];

Here you return exponential factor since it is conugated just like constant b.

Code:
a=0.6`1000; 
w=1`1000; 
g=1`1000;
b=(1`1000+2`1000*I) Exp[-I*w*t-g*t];
v1n=Normalize[N[v1,1000]]; 
v2n=Normalize[N[v2,1000]];
Abs1={Abs[v1n[[1]]],Abs[v1n[[2]]]};
Abs2={Abs[v2n[[1]]],Abs[v2n[[2]]]};
 
Thanks djelovin! It seems that I could fix it doing what you told me and also defining the values of the parameters after the calculations. I'm new to this. Thanks again.
 
I believe the underlying problem can be seen if you get rid of all your decimal points and N and attempts to fix this with thousand digit precision and just look at the exact values that you are attempting to calculate with approximate math.

For example, you can see your Abs1 for t==50 has -(E^50)/5+Sqrt[20+(E^100)/25] in both your numerator and denominator.

In[1]:= Table[Abs1,{t,50,50}]

Out[1]= {{(-E^50/5 + Sqrt[20 + E^100/25])/ (2*Sqrt[5*(1 + (-E^50/5 + Sqrt[20 + E^100/25])^2/20)]), 1/Sqrt[1 + (-E^50/5 + Sqrt[20 + E^100/25])^2/20]}}

FabulouslyCloseToZeroButApproximated/ FabulouslyCloseToZeroButApproximated and then throwing this at Plot doesn't seem so surprising when I make tables of those values and see that when t gets large enough that your error bits fall on the wrong side of the scale sometimes.

In other words your problem is what I believe I remember they call "ill posed."

If I'm remembering the right title, there is a nice little book from about 20 years ago titled "Real Computing Made Real: Preventing Errors In Scientific And Engineering Calculations" that tries to teach how to reformulate ill posed problems so that you get much greater accuracy in the results. Ah! Dover has republished that. I highly recommend that one to anyone pushing bits around.
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
Replies
4
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 17 ·
Replies
17
Views
46K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K