Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: Eigen problem

  1. Jun 17, 2012 #1
    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!
     

    Attached Files:

    • PB.nb
      PB.nb
      File size:
      6.9 KB
      Views:
      92
  2. jcsd
  3. Jun 18, 2012 #2
    You should avoid to letting Mathematica works with lots of symbols. Just absorb exponential factor in constant b and redefine it later.

    Code (Text):

    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 (Text):

    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]]]};
     
     
  4. Jun 18, 2012 #3
    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.
     
  5. Jun 19, 2012 #4
    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: Jun 19, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica: Eigen problem
  1. Mathematica problems (Replies: 2)

  2. Mathematica Problem (Replies: 3)

  3. Mathematica problem (Replies: 4)

  4. Mathematica problem (Replies: 2)

Loading...