Homework 10, due December 8, 2004.

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

Homework 10, due December 8, 2004.

Post by goodwine »

  1. Consider
    • Image
    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
      Image
    4. Compute Image
    5. Compute Image
    6. Solve
      • Image
  2. Consider
    • Image
    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
      Image
    4. Compute Image You may use a computer to compute the inverse of any matrix that has dimensions greater than 2 x 2.
    5. Compute Image
    6. Solve
      • Image
  3. Solve
    • Image
    where
    • Image
    for the cases where
    • Image
    On the same plot, plot x1 versus x2 for 0 < t < 30.
  4. Do problem 3 again but for when
    Image.
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.

Post by mjesick »

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

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

Re: Homework 10, due December 8, 2004.

Post by goodwine »

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

Post by The Kid »

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

Re: Plots

Post by goodwine »

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

Post by Grendel »

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
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Mathematica

Post by goodwine »

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

Post by acrutchf »

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[4]:=
Eigenvectors[m1={{2 ,-1},{0,1}}]

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

Re: problem 1

Post by goodwine »

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[4]:=
Eigenvectors[m1={{2 ,-1},{0,1}}]

Out[4]=
{{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

Post by PhillyPhan17 »

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

Post by 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

Post by student »

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

Post by student »

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

Post by 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

Post by 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.

You can download Mathematica 5 from OIT for windoze.

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

Post by 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

Post by student »

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

Re: Numbers 3, 4

Post by goodwine »

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
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Post by goodwine »

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
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: mathematica

Post by goodwine »

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
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: 3 and 4

Post by goodwine »

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?

Post by Grendel »

is there going to be solutions posted soon?
7

Re: solutions?

Post by 7 »

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

Return to “AME 301 Homework 10”