|
-
Apr 26th, 2006, 03:57 PM
#1
Thread Starter
New Member
matrices help again (inverse) please
hi there would anyone be able to give me a link or guidence as how i would go about finding the inverse of A? I have a book that tells me add subtract and multiply.
the question is this: find the inverse of A
A =
(19 81)
(2 10)
sorry for the crude matrices. any help would be great 
lakitu
-
Apr 26th, 2006, 05:01 PM
#2
Re: matrices help again (inverse) please
 Originally Posted by lakitu
hi there would anyone be able to give me a link or guidence as how i would go about finding the inverse of A? I have a book that tells me add subtract and multiply.
the question is this: find the inverse of A
A =
(19 81)
(2 10)
sorry for the crude matrices. any help would be great
lakitu
Hello.
Matrices can be inverted by various algorithms. It's not easy to explain in a few words so I suggest you Google around. Yot can search for "matrix inversion", "Gauss-Jordan", "LU decomposition", etc.
Or you can go to http://mathworld.wolfram.com/topics/Matrices.html or http://mathworld.wolfram.com/topics/...perations.html or http://mathworld.wolfram.com/MatrixInverse.html
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Apr 26th, 2006, 07:54 PM
#3
Thread Starter
New Member
Re: matrices help again (inverse) please
thank you i will try those links now
-
Apr 27th, 2006, 05:40 AM
#4
Frenzied Member
Re: matrices help again (inverse) please
A more general solution
VB Code:
Public Function MxInverse(Matrix() As Double) As Double()
Dim i As Long
Dim j As Long
Dim Rows As Long
Dim Cols As Long
Dim Tmp() As Double
Dim Ret() As Double
Dim Degree As Long
Tmp = Matrix
Rows = UBound(Tmp, 1)
Cols = UBound(Tmp, 2)
Degree = Cols + 1
'Augment Identity matrix onto matrix M to get [M|I]
ReDim Preserve Tmp(Rows, (Degree * 2) - 1)
For i = Degree To (Degree * 2) - 1
Tmp(i Mod Degree, i) = 1
Next
' Now find the inverse using Gauss-Jordan Elimination which should get us [I|A-1]
MxGaussJordan Tmp
' Copy the inverse (A-1) part to array to return
ReDim Ret(Rows, Cols)
For i = 0 To Rows
For j = Degree To (Degree * 2) - 1
Ret(i, j - Degree) = Tmp(i, j)
Next
Next
MxInverse = Ret
End Function
Public Sub MxGaussJordan(Matrix() As Double)
Dim Rows As Long
Dim Cols As Long
Dim P As Long
Dim i As Long
Dim j As Long
Dim m As Double
Dim d As Double
Dim Pivot As Double
Rows = UBound(Matrix, 1)
Cols = UBound(Matrix, 2)
' Reduce so we get the leading diagonal
For P = 0 To Rows
Pivot = Matrix(P, P)
For i = 0 To Rows
If Not P = i Then
m = Matrix(i, P) / Pivot
For j = 0 To Cols
Matrix(i, j) = Matrix(i, j) + (Matrix(P, j) * -m)
Next
End If
Next
Next
'Divide through to get the identity matrix
'Note: the identity matrix may have very small values (close to zero)
'because of the way floating points are stored.
For i = 0 To Rows
d = Matrix(i, i)
For j = 0 To Cols
Matrix(i, j) = Matrix(i, j) / d
Next
Next
End Sub
It is not optimised. You should use LU Decomposition for better algorithmic performance, and make of CopyMemory to increase the code performance. Nevertheless; it works
"As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein
It's turtles! And it's all the way down
-
Apr 27th, 2006, 06:50 AM
#5
Re: matrices help again (inverse) please
Here is a tutorial with fully worked examples on LU decomposition and its application tfor finding the inverse of a matrix.
And this is from the very famous "Numerical Recipes" book that's available on-line: http://www.library.cornell.edu/nr/bookcpdf/c2-3.pdf
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
Apr 29th, 2006, 03:48 PM
#6
Member
Re: matrices help again (inverse) please
Let Matrix A =
(a b)
(c d)
So the inverse = A^-1 =
(d -b) x 1/[ad-bc]
(-c a)
So for your matrix, the inverse of
(19 81)
(2 10)
is
(10 -81) x 1/(190-162) =
(-2 19)
([5/14] [-81/28])
([-1/14] [19/28]).
-
May 6th, 2006, 08:53 PM
#7
Frenzied Member
Re: matrices help again (inverse) please
Several years ago there was a thread at this forum whihc descibed matrix inversion, determinant evaluation, and solution of simultaneous linear equations.
A search might find it.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
May 13th, 2006, 04:39 AM
#8
Fanatic Member
Re: matrices help again (inverse) please
 Originally Posted by lakitu
hi there would anyone be able to give me a link or guidence as how i would go about finding the inverse of A? I have a book that tells me add subtract and multiply.
the question is this: find the inverse of A
A =
(19 81)
(2 10)
sorry for the crude matrices. any help would be great
lakitu
For your martix:
A inverse =
(10 -81)
(-2 19)
-
May 13th, 2006, 06:29 AM
#9
Member
Re: matrices help again (inverse) please
You didn't multiply by the reciprocal of the determinant x-ice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|