hi i want a c program to find the inverse of 3X3 matrix
urgent
i need it
fast
anyoone reply
thanks
1 19769 Banfa 9,065
Expert Mod 8TB
Here is some visual basic code that does something similar, see if you can convert and adapt it.
Can you describe the process of inverting a matrix? -
Private Function InternalMatrixSolve(ByRef r1() As Double, ByRef r2() As Double, ByVal size%)
-
Dim Matrix(2, 2) As Double
-
Dim Vector(2) As Double
-
-
Rem Set up the normalised matrix and vector
-
-
For y% = 0 To 2
-
For x% = 0 To 2
-
Matrix(y%, x%) = 0
-
For r% = 1 To size
-
Matrix(y%, x%) = Matrix(y%, x%) + ((r1(r%) ^ y%) * (r1(r%) ^ x%))
-
Next
-
Next
-
-
Vector(y%) = 0
-
For r% = 1 To size
-
Vector(y%) = Vector(y%) + ((r1(r%) ^ y%) * r2(r%))
-
Next
-
Next
-
-
For y% = 0 To 2
-
-
Rem Get a 1 on the diagonal by dividing through the current line by the diagnoal cell
-
Divisor# = Matrix(y%, y%)
-
-
If Divisor# = 0 Then
-
InternalMatrixSolve = "MATHS ERROR"
-
Exit Function
-
End If
-
-
For x% = y% To 2
-
Matrix(y%, x%) = Matrix(y%, x%) / Divisor#
-
Next
-
-
Vector(y%) = Vector(y%) / Divisor#
-
-
Rem get 0s below the current diagonal by taking away multiples of the current line
-
For y2% = y% + 1 To 2
-
Multiplier# = Matrix(y2%, y%)
-
For x% = y% To 2
-
Matrix(y2%, x%) = Matrix(y2%, x%) - (Matrix(y%, x%) * Multiplier#)
-
Next
-
-
Vector(y2%) = Vector(y2%) - (Vector(y%) * Multiplier#)
-
Next
-
Next
-
-
Rem we now have 1s on the diagnoal and )s below the diagonal
-
Rem need to get 0s above the diagonal
-
-
For y% = 2 To 0 Step -1
-
-
Rem get 0s above the current diagonal by taking away multiples of the current line
-
For y2% = y% - 1 To 0 Step -1
-
Multiplier# = Matrix(y2%, y%)
-
For x% = y% To 2
-
Matrix(y2%, x%) = Matrix(y2%, x%) - (Matrix(y%, x%) * Multiplier#)
-
Next
-
-
Vector(y2%) = Vector(y2%) - (Vector(y%) * Multiplier#)
-
Next
-
Next
-
-
InternalMatrixSolve = Vector
-
End Function
Sign in to post your reply or Sign up for a free account.
Similar topics
by: vishnu mahendra |
last post by:
hello to all,
can any one please give me an algorithm to find inverse of a matrix of order
n rows and m columns.
thank you in advance,
vishnu.
|
by: ravleen bindra |
last post by:
please tell me how to find inverse of a nxm matrix in C programming language
|
by: ajeetbaraskar |
last post by:
can any one send me the codining for finding out inverse of a 6x6 matrix
|
by: YUSUF ISIAKA |
last post by:
Him please help me with the codes for the following questions:
1. Write a program in c/c++ to compute the inverse of a square matrix.
2. Write a program in c/c++ to compute the determinant of a...
|
by: leelaramtenneti |
last post by:
hello I need a program to find a Inverse of a square complex matrix in java... . The program should calculate the inverse of a matrix in which each element has both real and imaginary parts. Or...
|
by: leelaramtenneti |
last post by:
How to find inverse of a complex matrix ????
|
by: DarrenWeber |
last post by:
# Copyright (C) 2007 Darren Lee Weber
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free...
|
by: aaram81 |
last post by:
I need a help in C++ for the following question:
write a p[rogram to read 4 by 4 matrix, store it and find the inverse of this matrix. then multiply the inverse with the original matrix , store it ....
|
by: dazzler |
last post by:
Hi! I have problem with numpy, multiplying with an inversed matrix will crash python :(
this works fine:
from numpy import matrix
A = matrix(,])
B = matrix(,])
print A.I #inverse matrix
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |