Announcement

Collapse
No announcement yet.

is there a very easy to code way of calculating the determinant using the inverse?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • is there a very easy to code way of calculating the determinant using the inverse?

    I've painstakingly debugged my code that brings a matrix into reduced echelon form, to calculate the inverse. The prospect of writing the recursive function for the determinant is not inviting. Isn't there some way of using the inverse to find the determinant?

  • #2
    a) the determinant of the inverse is the inverse of the determinant

    b) instead of using a recursive function to calculate the determinant by minors, use the the even/odd permutation definition of determinant

    c) write down the eigenvalue equation for the matrix, solve for the roots and multiply them together to get the determinant
    12-17-10 Mohamed Bouazizi NEVER FORGET
    Stadtluft Macht Frei
    Killing it is the new killing it
    Ultima Ratio Regum

    Comment


    • #3
      The determinant is properly defined as:

      the sum over all permutations sigma of (-1)^(sign of sigma) a1sigma(1)a2sigma(2)...ansigma(n)
      12-17-10 Mohamed Bouazizi NEVER FORGET
      Stadtluft Macht Frei
      Killing it is the new killing it
      Ultima Ratio Regum

      Comment


      • #4
        I've painstakingly debugged my code that brings a matrix into reduced echelon form, to calculate the inverse. The prospect of writing the recursive function for the determinant is not inviting. Isn't there some way of using the inverse to find the determinant?


        Not unless its inverse is easy to calculate.

        Easiest way would be this:

        detA = eq1...qnA1q1...Anqn

        Edit: In case it's not clear, the summation over each qm is implied through repeated indices. And eq1...qn gives 1 if q1..qn is an even permutation of 1...n, -1 if it's an odd permutation.
        Last edited by Ramo; March 6, 2005, 23:22.
        "Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before. He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way. "
        -Bokonon

        Comment


        • #5
          MATH DORK THREAD!@@!~!!@!!!!@111one!!11!!!
          To us, it is the BEAST.

          Comment


          • #6
            If you've written down the row-reduced echelon form of the matrix and this has non zero determinant (i.e. it's the unit matrix) then if you've kept track of the operations performed to get ther then the determinant is trivial to calculate...
            12-17-10 Mohamed Bouazizi NEVER FORGET
            Stadtluft Macht Frei
            Killing it is the new killing it
            Ultima Ratio Regum

            Comment


            • #7
              Originally posted by KrazyHorse
              If you've written down the row-reduced echelon form of the matrix and this has non zero determinant (i.e. it's the unit matrix) then if you've kept track of the operations performed to get ther then the determinant is trivial to calculate...
              *looks at wikipedia*

              Thanks! That's really, really easy to implement.

              Comment


              • #8
                How big is this matrix?
                12-17-10 Mohamed Bouazizi NEVER FORGET
                Stadtluft Macht Frei
                Killing it is the new killing it
                Ultima Ratio Regum

                Comment


                • #9
                  Are you writing this in Fortran?

                  "The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
                  Ben Kenobi: "That means I'm doing something right. "

                  Comment


                  • #10
                    Originally posted by KrazyHorse
                    How big is this matrix?
                    Arbitrarily sized (= I hardcoded allocation of 100x100 ints assuming my instructor won't wan't to type 10,000 numbers in to check my program ).

                    And it's in C.

                    Comment


                    • #11
                      Won't it take forever to run anything larger than 20X20 or so?
                      12-17-10 Mohamed Bouazizi NEVER FORGET
                      Stadtluft Macht Frei
                      Killing it is the new killing it
                      Ultima Ratio Regum

                      Comment


                      • #12
                        Probably.

                        (The assignment is a linear algebra assignment, it's more my computer architecture class. It's more a "can you write in C, and can you do all this stuff while handling all sorts of crap user input and make it bug-free" sort of assignment.)

                        Comment


                        • #13
                          I think exact inversion runs in N^3 time. Can't remember.
                          12-17-10 Mohamed Bouazizi NEVER FORGET
                          Stadtluft Macht Frei
                          Killing it is the new killing it
                          Ultima Ratio Regum

                          Comment


                          • #14
                            My algorithm is N^3, I think.

                            Comment


                            • #15
                              approximate numerical inversion is much faster.
                              12-17-10 Mohamed Bouazizi NEVER FORGET
                              Stadtluft Macht Frei
                              Killing it is the new killing it
                              Ultima Ratio Regum

                              Comment

                              Working...
                              X