Getting Eigenvalues and Eigenvectors

In classical mechanics we often encounter problems requiring some linear algebra - finding the eigenvalues and eigenvectors associated with the matrices we generate for the solution of several, simultaneous equations of motion. In this notebook we introduce some of the commands that can be useful for solving such problems. Some of these calculations are based on the solution of the coupled, simple pendula problem shown in the figure below.

1. Getting Eigenvalues.

Start with a matrix and then solve it to get the eigenvalues. To create a matrix go to Palettes→Basic Math Assistant and click on the Advanced tab. You should see a button with a matrix image. Click that button and you will get an empty 2x2 matrix at your cursor location.  Put the cursor over the matrix button in the palette to get directions for adding rows or columns. Consider the example here.

A0=(({{5, 8, 16}, {4, 1, 8}, {-4, -4, -11}}));
I0=(({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}));

Get the determinant.

poly1=Det[A0 - lambda*I0]

Factor the polynomial.

Factor[poly1]

You can also use the Eigenvalues command directly.

Eigenvalues[A0]

You can also do symbolic calculations. Here we are using the results from the coupled, simple pendula.

A1=(({{kappa-k, k}, {k, kappa-k}}));
I1=(({{1, 0}, {0, 1}}));
poly2=Det[A1 - lambda*I1];
Factor[poly2]

You can do the same thing with the Eigenvalues command.

Eigenvalues[A1]

2. Getting eigenvectors

To get the the eigenvectors of the matrices defined in Part 1 use the Eigenvectors command in Mathematica.

Eigenvectors[A1]

From this result you can’t tell which eigenvector goes with which eigenvalue so pick one of the eigenvectors and see what you get. The result should be that eigenvector multiplied by one of the eigenvalues.

test={-1,1};
A1.test

3. Getting the particular solution

You will have to figure out the coefficients for each eigenvector for a particular set of initial conditions. Here the general solution for the two,coupled pendula problem is the following.

X(t) = (Subscript[α, 1])(Subscript[X, 1])(e^((Subscript[iω, 1])t)) + (Subscript[α, 2])(Subscript[X, 1])(e^(-(Subscript[iω, 1])t)) + (Subscript[β, 1])(Subscript[X, 2])(e^((Subscript[iω, 2])t)) + (Subscript[β, 2])(Subscript[X, 2])(e^(-(Subscript[iω, 2])t))

where the (Subscript[ω, i]) are the eigenvalues, the (Subscript[α, i]) and (Subscript[β, i]) are coefficients, and 

(Subscript[X, 1])= (({{1}, {1}}))    and  (Subscript[X, 2])= (({{1}, {-1}}))

When you apply the initial conditions you will get a set of simultaneous equations analogous to the one shown below.

(Subscript[α, 1]) + (Subscript[α, 2])  + (Subscript[β, 1]) + (Subscript[β, 2]) = A
(Subscript[β, 1]) + (Subscript[β, 2])  + (Subscript[α, 1])  - (Subscript[α, 2]) = B
(Subscript[ω, 1])(Subscript[α, 1]) + (Subscript[ω, 1])(Subscript[α, 2])  + (Subscript[ω, 2])(Subscript[β, 1]) + (Subscript[ω, 2])(Subscript[β, 2]) = C
(Subscript[ω, 1])(Subscript[α, 1]) - (Subscript[ω, 1])(Subscript[α, 2])  - (Subscript[ω, 2])(Subscript[β, 1]) + (Subscript[ω, 2])(Subscript[β, 2]) = D

Which can be solved using (big surprise!) the Solve command. An example is shown below.

Solve[a1+a2+b1+b2==A && a1-a2+b1+b2==B&& w1*a1 + w1*a2 + w2*b1 + w2*b2==C && w1*a1 - w1*a2 - w2*b1 +w2*b2==D,{a1,a2,b1,b2}]