Eigenvectors from eigenvalues in c

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sentenced
    New Member
    • May 2012
    • 2

    Eigenvectors from eigenvalues in c

    Hello

    I started a project a bit late, and hit the wall, and time is running out, so asking for help :D

    How do I get eigenvectors in C?

    I have managed to get eigenvalues from matrix. Is there any specific way to get them for 2x2, 3x3 and 4x4 by one function, or do you need multiple ways to get them for each size

    ATM I am trying to reduce matrix to echelon form but can't seem to hit the algorithm.

    Even then, I am not sure how to solve the equations when I do get it to row echelon form.

    I would attach code so far (350 lines) but it is in other language then english, so could be a mess for english speakers.

    For now, I have original matrix in 2D array, I have eigenvalues in variables, and I have second matrix that has result of Eigenvalue*I - A (eigenvalue times matrix that has 1 on diagonal minus original matrix)

    So my form for now is lets say in example:
    -1 0 -1 v1 0
    -2 0 -2 v2 = 0
    -1 0 -1 v3 0

    I would really appreciate a bit more concrete answer then linking algorithms, code example would help more since I already spended 10 hours on google and trying to implement various algorithm, but any kind of help is more then welcome. I have 10 hours left for my assigment. I also have implemented gauss elimination but that doesnt help me a lot at this point since it gives me back matrix with 1 on diagonal and I can't get eigenvectors out

    So question at the end is:
    How do i get eigenvector in C out from that form above, do I need to reduce to row echelon form, is there any formula I can implement for 2x2/3x3/4x4 matrix that can get eigenvectors out from what I have so far?
  • sentenced
    New Member
    • May 2012
    • 2

    #2
    btw, I do know how to solve it on paper, but don't know how to solve it in c since you can't exactly type in equations in the same form and calculate in the same way as human does :)

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      You may be able to type in he equations better than you think.

      For example, if I have to multiply two matrices I could write a function to multiply the matrices used as arguments and return a product matrix:

      Code:
      Matrix A;
      Matrix B;
      Matrix C;
      //add values to A and B
      
      C = MultiplyMatrix(A, B);
      If you use C++ you can reprogram the multiply operator (*) and the assignment operator (=) so your code would be:

      Code:
      C = A * B;
      which is very close to how you would write it on paper.

      I believe eignvalues and eigenvectors are widely used in engineering so I expect there are existing code libraries already written in C that you could use. I would not expect that you would need to do detailed caculations.

      Comment

      • onkaringale
        New Member
        • Apr 2020
        • 1

        #4
        Did you complete the project?
        Because I do have C program for Echelon Form.

        Comment

        Working...