## Homework 10, due December 8, 2004.

The last one! Due Wednesday, December 8, 2004. Grader: Alexandre Vorobiev (avorobie@nd.edu).
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Homework 10, due December 8, 2004.

1. Consider
• 1. Compute (by hand) the eigenvectors and eigenvalues of A.
2. Construct the matrix T whose columns are the eigenvectors of A.
3. Verify by direct computation that 4. Compute 5. Compute 6. Solve
• 2. Consider
• 1. Compute (by hand) the characteristic equation of A that the eigenvalues of A satisfy. Using a computer, if necessary, determine the eigenvectors and eigenvalues of A.
2. Construct the matrix T whose columns are the eigenvectors of A.
3. Verify by direct computation that 4. Compute You may use a computer to compute the inverse of any matrix that has dimensions greater than 2 x 2.
5. Compute 6. Solve
• 3. Solve
• where
• for the cases where
• On the same plot, plot x1 versus x2 for 0 < t < 30.
4. Do problem 3 again but for when .
Last edited by goodwine on Thu Jun 15, 2006 4:35 pm, edited 1 time in total.
mjesick

### Re: Homework 10, due December 8, 2004.

"On the same plot, plot x1 versus x2 for 0 < t < 30."

...what are x1 and x2?
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: Homework 10, due December 8, 2004.

mjesick wrote:"On the same plot, plot x1 versus x2 for 0 < t < 30."

...what are x1 and x2?
x1 and x2 are the two componetnts of x, i.e., x=(x1,x2).

If it's still not clear, skim the first section of chapter 9 -- that's what this is leading up to.
The Kid

### Plots

Did you want the plots done with C code?
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: Plots

The Kid wrote:Did you want the plots done with C code?
You may use whatever you want to plot.
Bill Goodwine, 376 Fitzpatrick
Grendel

### Mathematica

I was checking my work on mathematica for problem #1. I got

Code: Select all

``````T=[1 1]
[0 1]``````
but the computer gave

Code: Select all

``````T=[1 0]
[1 1] ``````
which is correct. and also when you do Exp[T^-1 *A*T] since T^-1 *A*T has some 0's in it, should Exp^0 be = 1, but in the notes you said you wanted it to be a diagonal matrix. Should Exp[T^-1 *A*T] contain 1's or 0's ??
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: Mathematica

Grendel wrote:I was checking my work on mathematica for problem #1. I got

Code: Select all

``````T=[1 1]
[0 1]``````
but the computer gave

Code: Select all

``````T=[1 0]
[1 1] ``````
which is correct. and also when you do Exp[T^-1 *A*T] since T^-1 *A*T has some 0's in it, should Exp^0 be = 1, but in the notes you said you wanted it to be a diagonal matrix. Should Exp[T^-1 *A*T] contain 1's or 0's ??
exp(T^{-1} A T} has 0's in it.

You don't want to think of it as exponentiating each term, but rather, because it's diagonal, when you compute all the powers in the series expansion for the matrix exponential, all the higher powers are diagonal as well.

With regard to T, I usually use Eigensystem in mathematica. That way I can pair the eigenvalues with the eigenvectors (they are printed in order).
Bill Goodwine, 376 Fitzpatrick
acrutchf

### problem 1

I tried problem 1, got a different answer than a friend for T because he swapped the order of his eigenvalues (z1 was his z2) and it changed T from my (1 1),(0 1) to (1 1),(1 0) and mathematica gave us (1 0),(1 1)... what is the problem? this is the mathematica code i used:
In:=
Eigenvectors[m1={{2 ,-1},{0,1}}]

Out=
{{1,0},{1,1}}
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: problem 1

acrutchf wrote:I tried problem 1, got a different answer than a friend for T because he swapped the order of his eigenvalues (z1 was his z2) and it changed T from my (1 1),(0 1) to (1 1),(1 0) and mathematica gave us (1 0),(1 1)... what is the problem? this is the mathematica code i used:
In:=
Eigenvectors[m1={{2 ,-1},{0,1}}]

Out=
{{1,0},{1,1}}
T may differ for different people if you choose the eigenvectors and eigenvalues in a different order (remember they come in pairs, though). Your final x(t) answer should be identical, though.

You may want to use Eigensystem[] in mathematica -- that gives both the eigenvalues and eigenvectors, and they are ordered so that the first eigenvalue goes with the first eigenvector, etc.
Bill Goodwine, 376 Fitzpatrick
PhillyPhan17

### Numbers 3, 4

I just wanted to clarify whats going on in problems 3 and 4. Does x(0) correspond to an initial point on the graph where the top number in the vector is x1 and the bottom number is x2? Also, is it acceptable to plot x1 vs. x2 by hand?....i'm not really sure how to do it using C or Mathematica....
kdormuth
Is there a way, in MatLab, to input data directly into a function? For example, if I create a function, f(x,y) and I have a data set, data=(x,y) is there any way to input data directly into f when I call that function? ie f(data) = f(x,y)
Thanks!
-Kristin
student

### mathematica

In Mathematica, I used
A = {{100, -90, -9}, {0, 10, -9}, {0, 0, 1}}

Eigenvalues[A]
{100,10,1}

T = Eigenvectors[A]
{{1,0,0},{1,1,0},{1,1,1}}

which is what I got by hand, but when I try to compute AT I get
A T
{{100,-90,-9},{0,10,0},{0,0,0}}, which is not what I get; Matlab gives me
{{1,1,1},{10,10,0},{100,0,0}}, which IS what I get.

I got the inverse of T, X to be the same as both programs
X = Inverse[T]
{{0,0,1},{0,1,-1},{1,-1,0}}
but again, Matlab says the same as I do for X*A*T, but Mathematica says

X A T
{{0,0,-9},{0,10,0},{0,0,0}}

Why does Mathematica give differnet answers?[/code]
student

### 3 and 4

Is there a better way to plot 3 and 4, such as using some Matlab/Mathematica/C code, or do I just calculate X(t) for all 16 points?
7
Just for more clarification for #1 part e. Is the answer a matrix? Or is it just expressed as exp[matrix*t]?

The answer is a matrix. I want you to actually compute the matrix exponential.
grc585
hello fellow student,

yeah, Mathematica's kind of tricky sometimes.

You'd think putting two matrices together then shift-entering would multiply them.

BUT NO! You have to use the "." notation.

Start a matrix by hitting CTRL-SHIFT-C, use the palette, or find it in the menu.

Some nice shortcuts are shift-, and shift-enter for making new rows.

When I use the dot my AT multiplication comes out correctly. Make one matrix, type in a period, then another matrix.

Interesting.

Use the somewhat helpful help in the help menu, or pick up an old copy of "The Mathematica Book." (Stephen Wolfram- any version 2.0 and up ought to do.)

Hope that helps.
grc585
7,

My notes say e^(T^-1*A*T)t = a matrix with e^(lamba_n*t) as the diagonal entries.

If you're really smart (I'm not), then you followed exactly all the theory behind all this stuff and understand how we got that from the definition we had on an earlier day.

But that's why I show up for class and take notes Look at your notes from Monday and Friday, I believe. It builds up the theory for raising a # to the power of a matrix.

Let me know if I'm right/wrong here on anything.
student

### mathematica

Thank you, it did help
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: Numbers 3, 4

PhillyPhan17 wrote:I just wanted to clarify whats going on in problems 3 and 4. Does x(0) correspond to an initial point on the graph where the top number in the vector is x1 and the bottom number is x2? Also, is it acceptable to plot x1 vs. x2 by hand?....i'm not really sure how to do it using C or Mathematica....
Your interpretation is correct. You may plot it by hand as long as it's an accurate representation of the solution(s).
Bill Goodwine, 376 Fitzpatrick
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:
kdormuth wrote:Is there a way, in MatLab, to input data directly into a function? For example, if I create a function, f(x,y) and I have a data set, data=(x,y) is there any way to input data directly into f when I call that function? ie f(data) = f(x,y)
Thanks!
-Kristin
I'm sure there is an easy way to do this, but I don't know it. Sorry!
Bill Goodwine, 376 Fitzpatrick
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: mathematica

student wrote:In Mathematica, I used
A = {{100, -90, -9}, {0, 10, -9}, {0, 0, 1}}

Eigenvalues[A]
{100,10,1}

T = Eigenvectors[A]
{{1,0,0},{1,1,0},{1,1,1}}

which is what I got by hand, but when I try to compute AT I get
A T
{{100,-90,-9},{0,10,0},{0,0,0}}, which is not what I get; Matlab gives me
{{1,1,1},{10,10,0},{100,0,0}}, which IS what I get.

I got the inverse of T, X to be the same as both programs
X = Inverse[T]
{{0,0,1},{0,1,-1},{1,-1,0}}
but again, Matlab says the same as I do for X*A*T, but Mathematica says

X A T
{{0,0,-9},{0,10,0},{0,0,0}}

Why does Mathematica give differnet answers?[/code]
If you set T = Eigenvalues[A], then the rows of T are the eigenvectors, not the columns. Do a

Code: Select all

``````T = Transpose[T]
``````
to set things straight.
Bill Goodwine, 376 Fitzpatrick
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Re: 3 and 4

student wrote:Is there a better way to plot 3 and 4, such as using some Matlab/Mathematica/C code, or do I just calculate X(t) for all 16 points?
In either matlab or mathematica, one way would be, once you have the answer, just to do a Do or for loop for t = 0 to 30 and put the x1, x2 values into an array. Then just plot the array.
Bill Goodwine, 376 Fitzpatrick
Grendel

### solutions?

is there going to be solutions posted soon?
7

### Re: solutions?

Grendel wrote:is there going to be solutions posted soon?
I second that.