invet matrix (bis bis)

Use this forum to post Vensim related questions.
Post Reply
cchab
Junior Member
Posts: 7
Joined: Fri Feb 11, 2005 4:33 pm

invet matrix (bis bis)

Post by cchab »

Clearly Vesnim does'nt use the determinant of a matrix to compute the inverse.

Try the following tittle vensim program :
!****************************
liA:
(lia1-lia2)
~
~ |

"inv(mat a)"[cola,llA]=
invert matrix(mat A[llA,cola],ELMCOUNT(cola))
~
~ |

"mata *inv( mat A)"[liA,llA]=
SUM(mat A[liA,cola!]*"inv(mat a)"[cola!,llA])
~
~ ~ :SUPPLEMENTARY
|

cola:
(cola1-cola2)
~
~ |

mat A[liA,cola]=TABBED ARRAY(
6 12
1 2)
~
~ |

llA<->liA
~
~ |
**********************

The program computes the inverse of matrix A, then multiply A by invert (A). We should obtain a I matrix.

if A is singular (has determinant =0) as in the program you will obtained a wrong result because Vensim try to invert a singulat matrix. With a non singular A matrix the result is OK .

The question is : how to test non singularity of a matrix before using the INVERT MATRIX function ?

REgards
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

There is indeed a problem when INVERT MATRIX is passed a singular matrix. We will correct this in the next release to issue an error message and return a 0 matrix.

If you want to test for this condition in the current release you can multiply the matrix and its inverse and test that against an identiry matrix. The attached model shows one way to do this.

It would be helpful going forward if you could post message related to a single topic in a single thread.
Attachments
matrix.mdl
(2.15 KiB) Downloaded 338 times
Post Reply