Message Boards Message Boards

0
|
18437 Views
|
11 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Compute the eigenvalues and eigenvectors of a matrix?

Posted 6 years ago

Hello all,

I have been having a lot of trouble computing the eigenvalues and eigenvectors of a matrix for a problem that I am working on in computational fluid dynamics. I am new to Mathematica so I am not very familiar with the syntax and I can not find out what is wrong with my code. I have uploaded my script so that you can see how I am trying to compute the eigenvalues and eigenvectors (at the very end of the script). Any help is appreciated, thanks.

Attachments:
POSTED BY: John Thress
11 Replies

At least you have more or less simple expressions for 4 out of 6 Eigenvectors.

In case you don't know about it try

FortranForm[ eigenvector ]

I played a bit around with abbreviations in matrix A, but had no real success in making things easier to handle.

I think mma will calculate eignevectors in quite short a time if you feed numbers into matrix A, and as far as I know it is possible to connect mma to Fortran.

Kind regards HD

POSTED BY: Hans Dolhaine

No need to recur to FORTRAN: Just feed numbers in your mma-expression. E.g.

A1= A/.{gamma->.5, x1x->7, ...... and so on

You could as well try to find abbreviations for the matrix-elements of A, that could make things easier to handle.

POSTED BY: Hans Dolhaine
Posted 6 years ago

Abbreviations is a good idea, I may try that. I need to eventually put it into fortran because I am working with a computational fluid dynamics solver which is written in fortran. I am trying to let mathematica do the derivation of a physical problem for me so that I can add it to a pre-existing code. Ultimately, the eigenvector calculation will need to be done thousands of times as I step through the CFD solution.

POSTED BY: John Thress
Posted 6 years ago

I really appreciate your help, thank you so much. I now know that I will more than likely have to compute these numerically in my Fortran code. Thanks once again

POSTED BY: John Thress

After quite a time of computation mma comes back with explicit expressions for the Eigenvectors. Note that your systems is four-fold degenerate.

The 1st four Eigenvectors are "simple", the next two (belonging to the Eigenvlaues with square-root) by far not.

See notebook (at the end).

Attachments:
POSTED BY: Hans Dolhaine

Well, look at your expressions in matrix A. And A is 6 x 6 - Matrix. It seems to be utmost tedious if not impossible to obtain closed expressions for the eigenvectors. Try to do it numerically.

POSTED BY: Hans Dolhaine

Try

Eigensystem[ matrix ]

That gives you a list. 1st entry is the list of eigenvalues, 2nd entry is a list of Eigenvectors.

And I think you want

Transpose[Eigenvectors[ matrix ] ]

POSTED BY: Hans Dolhaine
Posted 6 years ago

Thank you so much.

Is this correct? I'm having trouble getting output.

Attachments:
POSTED BY: John Thress

I made a couple of changes in your notebook and arrive at a list of Eigenvalues. Is it that what you meant?

Attachments:
POSTED BY: Hans Dolhaine
Posted 6 years ago

Yes, this is exactly what I meant. Sorry, I am really new to mathematica and I was just getting confused with the syntax. I really appreciate your help. Is there any way you could tell me how to compute the eigenvectors as well? What I am trying to do is compute the eigenvectors (hopefully one eigenvector for each eigenvalue) and put them in a matrix where each column is an eigenvector. Does this make sense?

POSTED BY: John Thress
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract