Skip to main content

linear algebra - Difference In Eigenvectors


When running my program in both Mathematica and MathCad, I end up with the same eigenvalues, but different eigenvectors. The ones in MathCad are normalized, which the documentation for Mathematica says they too are normalized. I also tried Normalize[] and they still differed. Any advice for how to change it so that they match up?


EDIT:: Code



{{0. + 0. I, -0.00105652 + 0.00306633 I, -0.000992072 - 0.000550179 I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I, -0.00080248 - 0.000276499 I,
3.94975*10^-6 - 7.12212*10^-6 I,
0.0000192495 + 6.63251*10^-6 I, -7.8995*10^-6 +
0.0000142442 I, -2.53122*10^-6 - 2.0506*10^-6 I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I}, {0.00119848 - 0.00323969 I,
0. + 0. I, -0.00089753 + 0.00242618 I, -0.000743608 - 0.000434551 I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,

0. + 0. I, -1.5511*10^-6 + 8.53409*10^-6 I, -0.000868186 -
0.000321173 I, 8.75277*10^-6 - 0.0000149778 I,
0.0000203377 + 7.52365*10^-6 I, -8.75277*10^-6 +
0.0000149778 I, -2.64607*10^-6 - 2.24413*10^-6 I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I}, {-0.00124465 - 0.00025056 I, 0.000991057 - 0.00253121 I,
0. + 0. I, -0.000658751 + 0.00168248 I, -0.000461387 -
0.000281434 I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I,
0.0000212182 + 8.30765*10^-6 I, -3.59755*10^-6 +

0.0000178707 I, -0.000909167 - 0.00035597 I,
9.49275*10^-6 - 0.0000155626 I,
0.0000212182 + 8.30765*10^-6 I, -9.49275*10^-6 +
0.0000155626 I, -2.73555*10^-6 - 2.41019*10^-6 I, 0. + 0. I,
0. + 0. I, 0. + 0. I,
0. + 0. I}, {0. + 0. I, -0.000915438 - 0.000197309 I,
0.000705296 - 0.00173145 I,
0. + 0. I, -0.00034951 + 0.000858025 I, -0.000154043 -
0.0000968679 I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 3.97422*10^-6 - 0.0000184388 I,

0.0000218358 + 8.89464*10^-6 I, -3.97422*10^-6 +
0.0000184388 I, -0.000935629 - 0.000381122 I,
0.000010041 - 0.0000159676 I,
0.0000218358 + 8.89464*10^-6 I, -0.000010041 +
0.0000159676 I, -2.79628*10^-6 - 2.53224*10^-6 I, 0. + 0. I,
0. + 0. I, 0. + 0. I}, {0. + 0. I,
0. + 0. I, -0.000555325 - 0.000123831 I,
0.000361803 - 0.000870433 I, 0. + 0. I,
6.4961*10^-6 - 0.0000156284 I, 0.000167434 + 0.000106958 I,
0. + 0. I, 0. + 0. I, 0. + 0. I,

0. + 0. I, -3.83436*10^-6 - 1.7215*10^-7 I,
4.17683*10^-6 - 0.0000187311 I,
0.0000221515 + 9.20749*10^-6 I, -4.17683*10^-6 +
0.0000187311 I, -0.000949159 - 0.000394527 I,
0.0000103313 - 0.0000161729 I,
0.0000221515 + 9.20749*10^-6 I, -0.0000103313 +
0.0000161729 I, -2.82664*10^-6 - 2.59656*10^-6 I, 0. + 0. I,
0. + 0. I}, {0. + 0. I, 0. + 0. I,
0. + 0. I, -0.000180652 - 0.0000402588 I, -6.49204*10^-6 +
0.0000156244 I, 0. + 0. I, 0.000374561 - 0.000901456 I,

0.00049078 + 0.000313423 I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, -3.83319*10^-6 - 1.71599*10^-7 I,
4.17309*10^-6 - 0.0000187258 I,
0.0000221458 + 9.20173*10^-6 I, -4.17309*10^-6 +
0.0000187258 I, -0.000948914 - 0.00039428 I,
0.000010326 - 0.0000161692 I,
0.0000221458 + 9.20173*10^-6 I, -0.000010326 +
0.0000161692 I, -2.82609*10^-6 - 2.59538*10^-6 I,
0. + 0. I}, {0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0.000190732 + 0.0000410344 I, -0.000361392 + 0.000888151 I,

0. + 0. I, 0.000716521 - 0.00176091 I, 0.00080346 + 0.000504823 I,
0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, -3.76634*10^-6 - 1.40845*10^-7 I,
3.96361*10^-6 - 0.0000184233 I,
0.0000218189 + 8.87822*10^-6 I, -3.96361*10^-6 +
0.0000184233 I, -0.000934908 - 0.000380418 I,
0.0000100257 - 0.0000159566 I,
0.0000218189 + 8.87822*10^-6 I, -0.0000100257 +
0.0000159566 I, -2.79465*10^-6 - 2.52885*10^-6 I}, {0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,

0.000541679 + 0.000108715 I, -0.00066847 + 0.00171026 I, 0. + 0. I,
0.000999783 - 0.00255791 I, 0.00109362 + 0.000666203 I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, -3.63939*10^-6 - 8.56735*10^-8 I,
3.58173*10^-6 - 0.0000178461 I,
0.0000211913 + 8.28283*10^-6 I, -3.58173*10^-6 +
0.0000178461 I, -0.000908015 - 0.000354907 I,
9.46946*10^-6 - 0.0000155449 I,
0.0000211913 + 8.28283*10^-6 I, -9.46946*10^-6 +
0.0000155449 I}, {0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I,

0.000857822 + 0.000155255 I, -0.000904508 + 0.00245062 I, 0. + 0. I,
0.00120425 - 0.00326273 I, 0.00135116 + 0.000788249 I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, -3.46257*10^-6 - 1.56372*10^-8 I,
3.08334*10^-6 - 0.0000170362 I,
0.0000203025 + 7.49351*10^-6 I, -3.08334*10^-6 +
0.0000170362 I, -0.000869931 - 0.000321086 I,
8.72413*10^-6 - 0.0000149543 I,
0.0000203025 + 7.49351*10^-6 I}, {0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0.00112915 + 0.000178104 I, -0.00106069 + 0.00308684 I, 0. + 0. I,

0.0013247 - 0.00385516 I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I, -3.24913*10^-6 + 5.87823*10^-8 I,
2.53158*10^-6 - 0.0000160499 I,
0.0000192081 + 6.60019*10^-6 I, -2.53158*10^-6 +
0.0000160499 I, -0.000819963 - 0.000281752 I,
3.93415*10^-6 - 7.10805*10^-6 I}, {0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0.00135075 + 0.000179137 I, -0.00114114 + 0.00360727 I, 0. + 0. I,
0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I, 0. + 0. I,
0. + 0. I, -3.01338*10^-6 + 1.28696*10^-7 I,

1.98264*10^-6 - 0.0000149497 I,
0.0000179729 + 5.68564*10^-6 I, -9.91319*10^-7 +
7.47487*10^-6 I, -0.000749264 - 0.000237026 I}, {1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,

0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}

I will work on getting the MathCad, but the first few values of the 19th eigenvector should be -.001048-.001033i, -.002461-.00404i...




Comments

Popular posts from this blog

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...

mathematical optimization - Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. vars = u@# & /@ Range[3]; cons = Flatten@ { Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; Minimize[{Total@((vec1[[#]] - vec2[[u[#]]])^2 & /@ Range[1, 3]), cons}, vars, Integers] The error I get: Part::pkspec1: The expression u[1] cannot be used as a part specification. >> Answer Ok, it seems that one can get around Mathematica trying to evaluate vec2[[u[1]]] too early by using the function Indexed[vec2,u[1]] . The working MWE would then look like the following: vars = u@# & /@ Range[3]; cons = Flatten@{ Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; NMinimize[ {Total@((vec1[[#]] - Indexed[vec2, u[#]])^2 & /@ R...

What is and isn't a valid variable specification for Manipulate?

I have an expression whose terms have arguments (representing subscripts), like this: myExpr = A[0] + V[1,T] I would like to put it inside a Manipulate to see its value as I move around the parameters. (The goal is eventually to plot it wrt one of the variables inside.) However, Mathematica complains when I set V[1,T] as a manipulated variable: Manipulate[Evaluate[myExpr], {A[0], 0, 1}, {V[1, T], 0, 1}] (*Manipulate::vsform: Manipulate argument {V[1,T],0,1} does not have the correct form for a variable specification. >> *) As a workaround, if I get rid of the symbol T inside the argument, it works fine: Manipulate[ Evaluate[myExpr /. T -> 15], {A[0], 0, 1}, {V[1, 15], 0, 1}] Why this behavior? Can anyone point me to the documentation that says what counts as a valid variable? And is there a way to get Manpiulate to accept an expression with a symbolic argument as a variable? Investigations I've done so far: I tried using variableQ from this answer , but it says V[1...