×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# vb subroutine to invert a very large square matrix2

 Forum Search FAQs Links MVPs

## vb subroutine to invert a very large square matrix

(OP)
Hello, I am looking for a VB subroutine to invert a large (possibly 1000X1000) fully populated square matrix stored as an array (?) for a weapon simulation program I am working on.  The matrix should be fairly stable.  It is actually to be run in a VB macro in Excel.

I am sort of a novice at this point in vb programming.

Any help in this area would be very much apprecited!!!
Replies continue below

### RE: vb subroutine to invert a very large square matrix

see if this helps:

### RE: vb subroutine to invert a very large square matrix

navyguy,

Are you looking for the inverse to find the solution to the set of equations? If so, there are other methods (such as Gauss-Seidel) that will solve a large system but not return the matrix inverse. (Although the matrix inverse by itself can also be very useful.)

I have some subroutines that may help you (for solving systems and/or inverting a matrix), but it sounds like using the built-in Excel commands will take care of your problem.

### RE: vb subroutine to invert a very large square matrix

(OP)
Thankyou for responding!  What I am trying to do is to solve for the matrix J in the matrix operation, C*J=A, where C is a known fully populated n x n square matrix, J is a n x 1, and A is a another n x 1 but is only populated by values of 1.  Depending on the required accuracy, n could possibly be as high as 1000.

I have don ehtis in mathcad and the matrix appears fairly stable.  I want to be able to automate this since it is part of a parametric model that can be run multiple times and not need to be dependant on doing it in excel.

Anyone who could provide a "canned" subroutine would help tremendously!!

### RE: vb subroutine to invert a very large square matrix

navyguy,

I'm currently developing routines to solve systems of linear equations for educational purposes (ie they don't have many optimizations and only have minimal error handling - they are mainly to show how the algorithms work). I've only tested them for n up to about 20 equations but so far have had excellent results.

The routines include finding the determinant, matrix inversion, Gauss elimination, Gauss-Jordan, Gauss-Seidel, and L-U decomposition. If you are interested contact me at jmgsjg823@hotmail.com and I'll email you some files. They are being developed in VB6.

### RE: vb subroutine to invert a very large square matrix

navyguy,
I don't know if you have considered this, but
I believe Excel has an inherent limit.  I think
it is limited to 282 columns, which isn't an
insurmountable problem, but might be a problem
if you're looking for something quick and dirty
that runs in a macro on a 1000 by 1000 matrix.
Can someone else confirm this, or am I barking
at the moon?  Column IV is the max?
VW

### RE: vb subroutine to invert a very large square matrix

I believe the number is 256, not 282...

### RE: vb subroutine to invert a very large square matrix

ivymike,
That's why I asked.  I had heard 256,
but when I looked it up it 'peared to be
282, A thru Z, plus AA thru IV.  I get
26 plus 256, i.e. 26 + 9(I is the ninth
letter)*26 + 22(V is 22nd letter) which
equals 26 + 9*26 + 22 = 282.  But I
admit 256 makes more sense, so I asked
for my own personal information.  Thanks.
VW

### RE: vb subroutine to invert a very large square matrix

hehehe... I didn't try to do the math, I just numbered all of the columns and looked to see what value the last one contained.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!