Skip to content

Instantly share code, notes, and snippets.

@quirinpa
Last active January 28, 2016 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quirinpa/bf785f23b0a1c29e811e to your computer and use it in GitHub Desktop.
Save quirinpa/bf785f23b0a1c29e811e to your computer and use it in GitHub Desktop.

Mathematica is great to check results while studying linear algebra:

X = {{2, -1}, {3, -2}};
Print["result ", Eigenvalues[X], " ", Eigenvectors[X]]
calcM[\[Lambda]_] := \[Lambda] IdentityMatrix[2] - X;
Print["how to calculate:"];
MatrixForm[aux = calcM[\[Lambda]]]
r = calcM[\[Lambda] /. #] & /@ (e = Solve[(d = Det[aux]) == 0, \[Lambda]]);
Print[d, " ", \[Lambda] /. e, " ", MatrixForm[#] & /@ r]
v = Table[{ToExpression["v" <> ToString[i]]}, {i, 1, Length[X]}]
MatrixForm[RowReduce[#] .v] & /@ r
NullSpace[RowReduce[#]] & /@ r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment